-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the live benchmarks to the documentation
- Loading branch information
1 parent
6b6c949
commit f5fd417
Showing
36 changed files
with
393 additions
and
404 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
See the live benchmakrs: | ||
<!-- each graphics container MUST have an UNIQUE id --> | ||
<!-- filename aplhabetic order --> | ||
- [Cuboid](benchmarks/cuboid) | ||
- [Line](benchmarks/line) | ||
- [Point](benchmarks/point) | ||
- [Sphere](benchmarks/sphere) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<style> | ||
input, | ||
button, | ||
main, | ||
p, | ||
label { | ||
display: block; | ||
margin: 0 auto; | ||
text-align: center; | ||
} | ||
|
||
input { | ||
width: 100%; | ||
} | ||
|
||
#time { | ||
margin-bottom: 20px; | ||
} | ||
</style> | ||
|
||
<div id="container"> | ||
<label for="grid-size">Size of the grid:</label> | ||
<input type="number" id="grid-size" placeholder="30" value="30" /> | ||
<button id="run-test">Run the test</button> | ||
</div> | ||
|
||
<div id="time-container"></div> | ||
|
||
<script> | ||
document.getElementById('run-test').addEventListener('click', () => { | ||
document.querySelector('main')?.remove(); | ||
document.getElementById('container').appendChild(document.createElement('main')); | ||
|
||
const gridSize = document.getElementById('grid-size').value; | ||
|
||
const coords = new Array(gridSize ** 3); | ||
|
||
for (let i = 0; i < gridSize; i++) { | ||
for (let j = 0; j < gridSize; j++) { | ||
for (let k = 0; k < gridSize; k++) { | ||
coords[2 * i * gridSize ** 2 + 2 * j * gridSize + 2 * k] = [[i, j, k]]; | ||
coords[2 * i * gridSize ** 2 + 2 * j * gridSize + 2 * k + 1] = [[i + 0.5, j + 0.5, k + 0.5]]; | ||
} | ||
} | ||
} | ||
|
||
const startTime = performance.now(); | ||
|
||
drawGraphics3d( | ||
document.querySelector('main'), | ||
{ | ||
elements: [ | ||
{ | ||
type: 'cuboid', | ||
color: [1, 1, 1], | ||
coords, | ||
edgeForm: { showEdges: false } | ||
} | ||
], | ||
lighting: [ | ||
{ | ||
type: 'spot', | ||
angle: 1, | ||
color: [1, 0, 0], | ||
coords: [null, [1, 1, 1]], | ||
target: [null, [0.5, 0.5, 0.5]] | ||
}, | ||
{ | ||
type: 'spot', | ||
angle: 1, | ||
color: [0, 1, 0], | ||
coords: [null, [0, 0, 0]], | ||
target: [null, [0.5, 0.5, 0.5]] | ||
}, | ||
{ | ||
type: 'spot', | ||
angle: 1, | ||
color: [0, 0, 1], | ||
coords: [null, [0, 1, 1]], | ||
target: [null, [0.5, 0.5, 0.5]] | ||
} | ||
], | ||
viewpoint: [2, 2, 2] | ||
}, | ||
200 | ||
); | ||
|
||
const duration = performance.now() - startTime; | ||
|
||
let timeElement = document.getElementById('time'); | ||
|
||
if (!timeElement) { | ||
timeElement = document.createElement('p'); | ||
timeElement.id = 'time'; | ||
document.getElementById('time-container').appendChild(timeElement); | ||
} | ||
|
||
timeElement.innerText = `Time taken to draw ${gridSize ** 3} cuboids: ${duration / 1000} seconds`; | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<style> | ||
input, | ||
button, | ||
main, | ||
p, | ||
label { | ||
display: block; | ||
margin: 0 auto; | ||
text-align: center; | ||
} | ||
|
||
input { | ||
width: 100%; | ||
} | ||
|
||
#time { | ||
margin-bottom: 20px; | ||
} | ||
</style> | ||
|
||
<div id="container"> | ||
<label for="elements-number">Number of points:</label> | ||
<input type="number" id="elements-number" placeholder="10000" value="10000" /> | ||
<button id="run-test">Run the test</button> | ||
</div> | ||
|
||
<div id="time-container"></div> | ||
|
||
<script> | ||
document.getElementById('run-test').addEventListener('click', () => { | ||
document.querySelector('main')?.remove(); | ||
document.getElementById('container').appendChild(document.createElement('main')); | ||
|
||
const numberOfPoints = Math.floor(document.getElementById('elements-number').value / 10) * 10; | ||
|
||
const coords = new Array(numberOfPoints); | ||
|
||
for (let i = 0; i < numberOfPoints / 7; i++) { | ||
coords[i * 10] = [[0, 0, 0]]; | ||
coords[i * 10 + 1] = [[0, 0, i * 1024]]; | ||
coords[i * 10 + 2] = [[1, 1, i * 1024]]; | ||
coords[i * 10 + 3] = [[0, i * 1024, 0]]; | ||
coords[i * 10 + 4] = [[1, i * 1024, 1]]; | ||
coords[i * 10 + 5] = [[i * 1024, 0, 0]]; | ||
coords[i * 10 + 6] = [[i * 1024, 1, 1]]; | ||
coords[i * 10 + 7] = [[i * 1024, 0, i * 1024]]; | ||
coords[i * 10 + 8] = [[i * 1024, i * 1024, 0]]; | ||
coords[i * 10 + 9] = [[i * 1024, i * 1024, i * 1024]]; | ||
} | ||
|
||
const startTime = performance.now(); | ||
|
||
drawGraphics3d( | ||
document.querySelector('main'), | ||
{ | ||
elements: [ | ||
{ | ||
type: 'line', | ||
color: [0, 0, 0], | ||
coords | ||
} | ||
], | ||
viewpoint: [2, 2, 2] | ||
}, | ||
200 | ||
); | ||
|
||
const duration = performance.now() - startTime; | ||
|
||
let timeElement = document.getElementById('time'); | ||
|
||
if (!timeElement) { | ||
timeElement = document.createElement('p'); | ||
timeElement.id = 'time'; | ||
document.getElementById('time-container').appendChild(timeElement); | ||
} | ||
|
||
timeElement.innerText = `Time taken to draw a line crossing ${numberOfPoints} points: ${duration / 1000} seconds`; | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<style> | ||
input, | ||
button, | ||
main, | ||
p, | ||
label { | ||
display: block; | ||
margin: 0 auto; | ||
text-align: center; | ||
} | ||
|
||
input { | ||
width: 100%; | ||
} | ||
|
||
#time { | ||
margin-bottom: 20px; | ||
} | ||
</style> | ||
|
||
<div id="container"> | ||
<label for="grid-size">Size of the grid:</label> | ||
<input type="number" id="grid-size" placeholder="100" value="100" /> | ||
<button id="run-test">Run the test</button> | ||
</div> | ||
|
||
<div id="time-container"></div> | ||
|
||
<script> | ||
document.getElementById('run-test').addEventListener('click', () => { | ||
document.querySelector('main')?.remove(); | ||
document.getElementById('container').appendChild(document.createElement('main')); | ||
|
||
const gridSize = document.getElementById('grid-size').value; | ||
|
||
const coords = new Array(gridSize ** 3); | ||
|
||
for (let i = 0; i < gridSize; i++) { | ||
for (let j = 0; j < gridSize; j++) { | ||
for (let k = 0; k < gridSize; k++) { | ||
coords[i * gridSize ** 2 + j * gridSize + k] = [[i, j, k]]; | ||
} | ||
} | ||
} | ||
|
||
const startTime = performance.now(); | ||
|
||
drawGraphics3d( | ||
document.querySelector('main'), | ||
{ | ||
elements: [ | ||
{ | ||
type: 'point', | ||
color: [0, 0, 0], | ||
coords, | ||
pointSize: 0.01 | ||
} | ||
], | ||
viewpoint: [2, -4, 4] | ||
}, | ||
200 | ||
); | ||
|
||
const duration = performance.now() - startTime; | ||
|
||
let timeElement = document.getElementById('time'); | ||
|
||
if (!timeElement) { | ||
timeElement = document.createElement('p'); | ||
timeElement.id = 'time'; | ||
document.getElementById('time-container').appendChild(timeElement); | ||
} | ||
|
||
timeElement.innerText = `Time taken to draw ${gridSize ** 3} points: ${duration / 1000} seconds`; | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<style> | ||
input, | ||
button, | ||
main, | ||
p, | ||
label { | ||
display: block; | ||
margin: 0 auto; | ||
text-align: center; | ||
} | ||
|
||
input { | ||
width: 100%; | ||
} | ||
|
||
#time { | ||
margin-bottom: 20px; | ||
} | ||
</style> | ||
|
||
<div id="container"> | ||
<label for="grid-size">Size of the grid:</label> | ||
<input type="number" id="grid-size" placeholder="10" value="10" /> | ||
<button id="run-test">Run the test</button> | ||
</div> | ||
|
||
<div id="time-container"></div> | ||
|
||
<script> | ||
document.getElementById('run-test').addEventListener('click', () => { | ||
document.querySelector('main')?.remove(); | ||
document.getElementById('container').appendChild(document.createElement('main')); | ||
|
||
const gridSize = document.getElementById('grid-size').value; | ||
|
||
const coords = new Array(gridSize ** 3); | ||
|
||
for (let i = 0; i < gridSize; i++) { | ||
for (let j = 0; j < gridSize; j++) { | ||
for (let k = 0; k < gridSize; k++) { | ||
coords[i * gridSize ** 2 + j * gridSize + k] = [[i, j, k]]; | ||
} | ||
} | ||
} | ||
|
||
const startTime = performance.now(); | ||
|
||
drawGraphics3d( | ||
document.querySelector('main'), | ||
{ | ||
elements: [ | ||
{ | ||
type: 'sphere', | ||
color: [0.5, 0.5, 0.5], | ||
coords, | ||
radius: 0.1 | ||
} | ||
], | ||
lighting: [ | ||
{ | ||
type: 'ambient', | ||
color: [0.8, 0.2, 0.6] | ||
} | ||
], | ||
viewpoint: [2, -4, 4] | ||
}, | ||
200 | ||
); | ||
|
||
const duration = performance.now() - startTime; | ||
|
||
let timeElement = document.getElementById('time'); | ||
|
||
if (!timeElement) { | ||
timeElement = document.createElement('p'); | ||
timeElement.id = 'time'; | ||
document.getElementById('time-container').appendChild(timeElement); | ||
} | ||
|
||
timeElement.innerText = `Time taken to draw ${gridSize ** 3} spheres: ${duration / 1000} seconds`; | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.