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 createWatch1(last) {
return (last.next = {
obj: {a:1, b:2, c:3},
lastValue: 1,
field: 'a',
next: null
});
}
function createWatch2(last) {
return (last.next = {
obj0: {a:1}, lastValue0: 1, field0: 'a',
obj1: {a:1}, lastValue1: 1, field1: 'a',
obj2: {a:1}, lastValue2: 1, field2: 'a',
obj3: {a:1}, lastValue3: 1, field3: 'a',
obj4: {a:1}, lastValue4: 1, field4: 'a',
obj5: {a:1}, lastValue5: 1, field5: 'a',
obj6: {a:1}, lastValue6: 1, field6: 'a',
obj7: {a:1}, lastValue7: 1, field7: 'a',
obj8: {a:1}, lastValue8: 1, field8: 'a',
obj9: {a:1}, lastValue9: 1, field9: 'a',
next: null
});
}
var head1 = createWatch1({});
var current = head1;
for(var i = 1; i < 10000; i++) {
current = createWatch1(current);
}
var head2 = createWatch2({});
var current = head2;
for(var i = 1; i < 1000; i++) {
current = createWatch2(current);
}
dirtyCheck1 = function() {
var current = head1;
while(current) {
if (current.obj[current.field] !== current.lastValue) {
throw "Should not get here";
}
current = current.next;
}
};
dirtyCheck2 = function() {
var c = head2;
while(c) {
if (c.obj0[c.field0] !== c.lastValue0) throw "X";
if (c.obj1[c.field1] !== c.lastValue1) throw "X";
if (c.obj2[c.field2] !== c.lastValue2) throw "X";
if (c.obj3[c.field3] !== c.lastValue3) throw "X";
if (c.obj4[c.field4] !== c.lastValue4) throw "X";
if (c.obj5[c.field5] !== c.lastValue5) throw "X";
if (c.obj6[c.field6] !== c.lastValue6) throw "X";
if (c.obj7[c.field7] !== c.lastValue7) throw "X";
if (c.obj8[c.field8] !== c.lastValue8) throw "X";
if (c.obj9[c.field9] !== c.lastValue9) throw "X";
c = c.next;
}
};
Ready to run.
Test | Ops/sec | |
---|---|---|
dirtyCheck1 |
| ready |
dirtyCheck2 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.