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
const arr = [];
class Link {
prev = undefined;
constructor(list, value){
this.list = list;
this.value = value;
}
}
class List {
tail = undefined;
push(value){
const link = new Link(this, value);
link.prev = this.tail;
this.tail = link;
return link;
}
pop(){
this.tail = this.tail.prev;
}
}
const list = new List();
class Hybrid {
size = 0;
arr = [];
last = undefined;
push(value){
this.arr.push(value);
this.size++;
this.last = value;
}
pop(){
this.arr.pop();
this.size--;
this.last = this.arr[this.size-1];
}
}
const hybrid = new Hybrid();
class Hybrid2 {
size = 0;
arr = [];
push(value){
this.arr.push(value);
this.size++;
}
pop(){
this.arr.pop();
this.size--;
}
last(){
return this.arr[this.size-1];
}
}
const hybrid2 = new Hybrid2();
const add = 1;
const get = 10;
let val;
Ready to run.
Test | Ops/sec | |
---|---|---|
array |
| ready |
List |
| ready |
Hybrid |
| ready |
Hybrid 2 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.