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
<script>
class Queue {
enqueue(item) {
const node = {data: item};
if (this.tail) {
this.tail.next = node;
node.prev = this.tail;
this.tail = node;
} else {
this.head = this.tail = node;
}
}
dequeue() {
if (!this.head) {
return null;
}
const popped = this.head;
if (this.head === this.tail) {
this.head = this.tail = null;
} else {
this.head = this.head.next;
}
return popped.data;
}
}
</script>
var COUNT = 1_000;
var queue = new Queue();
var list = [];
delete COUNT;
delete queue;
delete list;
Ready to run.
Test | Ops/sec | |
---|---|---|
Shift |
| ready |
Queue |
| ready |
Slice |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.