Three.js - Vertex / Vector3
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
var Vector3, Vertex, j;
Vector3 = function(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
};
Vector3.prototype = {
constructor: Vector3,
addScalar: function(scalar) {
this.x += scalar;
this.y += scalar;
this.z += scalar;
}
}
Vertex = function() {
Vector3.apply(this, arguments)
};
Vertex.prototype = new Vector3;
Vertex.prototype.constructor = Vertex;
VertexB = function() {
Vertex.apply(this, arguments)
};
VertexB.prototype = new Vertex;
VertexB.prototype.constructor = VertexB;
VertexC = function() {};
VertexC.prototype = new Vector3;
VertexC.prototype.constructor = VertexC;
VertexD = function(x, y, z) {
Vector3.call( this );
this.x = x;
this.y = y;
this.z = z;
};
VertexD.prototype = new Vector3();
VertexD.prototype.constructor = VertexD;
OldVertex = function() {
this.position = new Vector3();
};
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
vector3 |
|
pending… |
vertex |
|
pending… |
VertexB |
|
pending… |
VertexC |
|
pending… |
VertexD |
|
pending… |
Assign vector3 to object |
|
pending… |
OldVertex |
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:
- Revision 1: published by idflood
- Revision 2: published
- Revision 3: published and last updated
- Revision 4: published by Brandon Jones
- Revision 5: published by Brandon Jones
- Revision 6: published by Vincent Thibault
1 comment
Hello there,
Nice tests!
I'm curious about the performance of the same browser, but on different OS, like: "chrome on ubuntu", "chrome on osx", "chrome on windows".
Do you have plans to show this kind of info?