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 nop() {}
function Chain() {
this._tail = {};
this._head = {next: this._tail};
} Chain.prototype = {
append: function (data) {
this._tail.data = data;
this._tail = this._tail.next = {};
},
each: function (fn) {
var node = this._head,
prevNode = node,
tail = this._tail;
function stamp() {
prevNode.next = node.next;
}
while ((node = node.next) !== tail) {
fn(node.data, stamp);
prevNode = node;
}
},
isEmpty: function () {
return this._head.next === this._tail;
}
};
function Chain_stripped() {
this._tail = {};
this._head = {next: this._tail};
} Chain_stripped.prototype = {
append: function (data) {
this._tail.data = data;
this._tail = this._tail.next = {};
},
each: function (fn) {
var node = this._head,
prevNode = node,
tail = this._tail;
while ((node = node.next) !== tail) {
fn(node.data);
prevNode = node;
}
},
isEmpty: function () {
return this._head.next === this._tail;
}
};
function Chain_manual(msg) {
this._tail = {};
this._head = {next: this._tail};
this._node = this._head;
this._prevNode = this._head;
} Chain_manual.prototype = {
append: function (data) {
this._tail.data = data;
this._tail = this._tail.next = {};
},
rewind: function () {
this._node = this._head;
},
next: function () {
this._prevNode = this._node;
this._node = this._node.next;
return this._node.data;
},
stamp: function () {
this._prevNode.next = this._node.next;
},
isEmpty: function () {
return this._node.next === this._tail;
}
};
Ready to run.
Test | Ops/sec | |
---|---|---|
array |
| ready |
Chain |
| ready |
Chain stripped |
| ready |
Chain manual |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.