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 Record1(n) {
this.record1Field = 1;
this.next = n;
this.value = 1;
}
function Record2(n) {
this.record2Field = 1;
this.next = n;
this.value = 2;
}
function Record3(n) {
this.record3Field = 1;
this.next = n;
this.value = 3;
}
function Record4(n) {
this.record4Field = 1;
this.next = n;
this.value = 4;
}
function Record5(n) {
this.record5Field = 1;
this.next = n;
this.value = 5;
}
function createRecord(i, m) {
var r = i % m;
if (r === 0) return new Record1();
if (r === 1) return new Record2();
if (r === 2) return new Record3();
if (r === 3) return new Record4();
if (r === 4) return new Record5();
throw "BOOM";
}
var record1 = [new Record1()];
var record2 = [new Record1()];
var record3 = [new Record1()];
var record4 = [new Record1()];
var record5 = [new Record1()];
for(var i = 0; i < 300; ++i) {
var n = createRecord(i, 1);
record1[record1.length - 1].next = n;
record1.push(n);
n = createRecord(i, 2);
record2[record2.length - 1].next = n;
record2.push(n);
n = createRecord(i, 3);
record3[record3.length - 1].next = n;
record3.push(n);
n = createRecord(i, 4);
record4[record4.length - 1].next = n;
record4.push(n);
n = createRecord(i, 5);
record5[record5.length - 1].next = n;
record5.push(n);
}
Ready to run.
Test | Ops/sec | |
---|---|---|
1 Record Type |
| ready |
2 Record Types |
| ready |
3 Record Types |
| ready |
4 Record Types |
| ready |
5 Record Types |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.