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
function translateSelf(a, x, y) {
a[4] += a[0] * x + a[2] * y;
a[5] += a[1] * x + a[3] * y;
}
function scaleSelf(a, s) {
a[0] *= s;
a[1] *= s;
a[2] *= s;
a[3] *= s;
}
function rotateSelf(a, angle) {
angle *= Math.PI / 180;
var a0 = a[0], a1 = a[1], a2 = a[2],
a3 = a[3], a4 = a[4], a5 = a[5],
s = Math.sin(angle),
c = Math.cos(angle);
a[0] = a0 * c + a2 * s;
a[1] = a1 * c + a3 * s;
a[2] = a0 * -s + a2 * c;
a[3] = a1 * -s + a3 * c;
a[4] = a4;
a[5] = a5;
}
function multiplySelf(a, b) {
var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],
b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5];
a[0] = a0 * b0 + a2 * b1;
a[1] = a1 * b0 + a3 * b1;
a[2] = a0 * b2 + a2 * b3;
a[3] = a1 * b2 + a3 * b3;
a[4] = a0 * b4 + a2 * b5 + a4;
a[5] = a1 * b4 + a3 * b5 + a5;
}
var domMatrix1 = new DOMMatrix();
domMatrix1.a = 3; domMatrix1.b = -4; domMatrix1.c = 5;
domMatrix1.d = -6; domMatrix1.e = 7; domMatrix1.f = -8;
var domMatrix2 = new DOMMatrix();
domMatrix2.a = 1; domMatrix2.b = 0; domMatrix2.c = 0;
domMatrix2.d = 1; domMatrix2.e = 0; domMatrix2.f = 0;
var matrix1 = new Float32Array(6);
matrix1[0] = 3; matrix1[1] = -4; matrix1[2] = 5;
matrix1[3] = -6; matrix1[4] = 7; matrix1[5] = -8;
var matrix2 = new Float32Array(6);
matrix2[0] = 1; matrix2[1] = 0; matrix2[2] = 0;
matrix2[3] = 1; matrix2[4] = 0; matrix2[5] = 0;
Ready to run.
Test | Ops/sec | |
---|---|---|
Javascript translateSelf |
| ready |
DOMMatrix translateSelf |
| ready |
Javascript scaleSelf |
| ready |
DOMMatrix scaleSelf |
| ready |
Javascript rotateSelf |
| ready |
DOMMatrix rotateSelf |
| ready |
Javascript multiplySelf |
| ready |
DOMMatrix multiplySelf |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.