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
A test case to see if concatenating an array instead of a string for an inflate library would perform better, based on this post: http://my.opera.com/emoller/blog/2011/05/01/javascript-performance
var precompiled = 'apple';
while (precompiled.length < 100) {
var offs = precompiled.length - 5;
for (var i = offs; i < offs + 10; ++i) {
// calling charAt(i) on `precompiled` will
// flatten the string in most engines
precompiled += precompiled.charAt(i);
}
}
Array.prototype.fjoin=function(d){for(var a=0,c=this.length,b="";a<c;a++)b+=a<c-1?this[a]+d:this[a];return b};
Ready to run.
Test | Ops/sec | |
---|---|---|
String |
| ready |
String w/o flattening |
| ready |
fjoin |
| ready |
join |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.