jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
<script src="https://github.com/mrdoob/three.js/raw/master/build/Three.js"></script>
<script src="https://github.com/mrdoob/three.js/raw/master/src/core/Matrix4.js"></script>
<script src="https://github.com/mrdoob/three.js/raw/master/src/core/Vector3.js"></script>
<script>
THREE.Matrix4.prototype.transformVector3_2 = function(v) {
var vx = v.x,
vy = v.y,
vz = v.z,
d = 1 / (this.n41 * vx + this.n42 * vy + this.n43 * vz + this.n44);
v.x = (this.n11 * vx + this.n12 * vy + this.n13 * vz + this.n14) * d;
v.y = (this.n21 * vx + this.n22 * vy + this.n23 * vz + this.n24) * d;
v.z = (this.n31 * vx + this.n32 * vy + this.n33 * vz + this.n34) * d;
return v;
};
THREE.Matrix4.prototype.transformVector3_3 = function(v) {
var vx = v.x,
vy = v.y,
vz = v.z,
d = 1 / (this.n41 * vx + this.n42 * vy + this.n43 * vz + this.n44);
if (d == 1) {
v.x = this.n11 * vx + this.n12 * vy + this.n13 * vz + this.n14;
v.y = this.n21 * vx + this.n22 * vy + this.n23 * vz + this.n24;
v.z = this.n31 * vx + this.n32 * vy + this.n33 * vz + this.n34;
} else {
v.x = (this.n11 * vx + this.n12 * vy + this.n13 * vz + this.n14) * d;
v.y = (this.n21 * vx + this.n22 * vy + this.n23 * vz + this.n24) * d;
v.z = (this.n31 * vx + this.n32 * vy + this.n33 * vz + this.n34) * d;
};
return v;
};
var a = new THREE.Matrix4();
var b = new THREE.Vector3(1, 1, 1);
var c = new THREE.Matrix4();
c.n44 = 1.1;
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
normal |
| ready |
improved |
| ready |
test if improved |
| ready |
test if improved with d not 1 (shouldn't occur normally) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.