Skip to content

Commit ef57b34

Browse files
BrianCraigmrdoob
authored andcommitted
Benchmarks Suite Added (mrdoob#8999)
* Upgrading BenchmarkJS to major version 2 * Added Benchmarks page * Updated old Vector3Components Benchmark * Real order * Float32 Array Benchs Added * Vector 3 Length Bench Added * Vector 3 Storage Bench Added * Deleted old benchmark pages * Added some functionality * Added Doc
1 parent 7e0a836 commit ef57b34

16 files changed

Lines changed: 1048 additions & 4351 deletions

test/benchmark/README.MD

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# THREEJS Benchmark Suite
2+
3+
### Example: Adding a New Suite
4+
5+
For adding a new Tests we need two things
6+
- Adding the Test File
7+
- Linking it on the benchmark.html page
8+
9+
Some example could be like this
10+
```javascript
11+
(function() {
12+
// We want to make sure THREE.JS is loaded for this Benchmark
13+
var THREE
14+
if (Bench.isTHREELoaded()) {
15+
THREE = Bench.THREE;
16+
} else {
17+
Bench.warning("Test Example Benchmark not loaded because THREEJS was not loaded");
18+
return;
19+
}
20+
21+
var s = Bench.newSuite("Example Benchmark Distance Calculation");
22+
23+
var v2a = new THREE.Vector2(3.0, 3.0);
24+
var v2b = new THREE.Vector2(9.0, -3.0);
25+
26+
var v3a = new THREE.Vector3(3.0, 3.0, 0.0);
27+
var v3b = new THREE.Vector3(9.0, -3.0, 0.0);
28+
29+
s.add("Vector3", function() {
30+
v3a.distanceTo(v3b);
31+
})
32+
33+
s.add("Vector2", function() {
34+
v2a.distanceTo(v2b);
35+
36+
})
37+
})();
38+
```
39+
40+
Remember that THREEJS library is only accesible via `Bench.THREE`

0 commit comments

Comments
 (0)