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
class List {
constructor() {
this.n = this.p = this;
}
[Symbol.iterator]() {
let current = this;
return {
next: () => {
current = current.n;
return {
done: current === this,
value: current
};
}
};
}
}
class List2 {
constructor() {
this.n = this.p = this;
}
*[Symbol.iterator]() {
for (let current = this.n; current != this; current = current.n) {
yield current;
}
}
}
const append = (element, data) => {
// link data (list node)
data.n = element;
data.p = element.p;
// link list
element.p = element.p.n = data;
};
const list1 = new List
const list2 = new List2
for (let i = 0; i < 1000; ++i) {
append(list1, { value: i })
append(list2, { value: i })
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Loop |
| ready |
Generator |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.