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>
function Iterator( c ){
this.buffer = [];
this.next = [];
this.skip = 0;
this.cutoff = c;
}
Iterator.prototype.submit = function( obj ){
if( obj === undefined ) return;
if( this.skip > this.cutoff ) this.next.push( obj );
else this.buffer.push( obj );
}
Iterator.prototype.receive = function(){
if( this.buffer.length === 0 ) return undefined;
if( this.skip < this.buffer.length ){
var result = this.buffer[this.skip];
this.skip = this.skip + 1;
return result;
}
this.buffer = this.next;
this.next = [];
this.skip = 1;
return this.buffer[0];
}
var cx = [];
for( var i=5; i<15; i++ ){
cx.push({
s: (Math.random() * i) + (Math.random() * i * i * i * i),
r: (Math.random() * i * 10) + (Math.random() * i * i * i)
});
}
console.log( cx );
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Push/shift |
| ready |
Unshift/pop |
| ready |
push/pop |
| ready |
submit/receive(1000) |
| ready |
submit/receive(10) |
| ready |
submit/receive(-1) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.