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
Ilustrating how changing the type of content of a variable breaks JIT
<script>
function correct(){
var a=123,b='zzz';
if(Math.random()>0.5){
b='zzzz';
a=1234;
}else{
b='zzzz';
a=1234;
}
b='zzzz';
a=1234;
a+=123456789;
b+='123456789';
}
function bad(){
var a=123,b='zzz';
if(Math.random()>0.5){
a='zzzz'; //messing types at random
b=1234;
}else{
b='zzzz';
a=1234;
}
b='zzzz';
a=1234;
b+=123456789;
a+='123456789';
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
correct |
| ready |
bad |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.