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
compare ways to quickly pad numbers (octets in an ip, for sorting)
var ip = '1.0.22.123';
var results =(
ip.replace(/\b[0-9]\b/g,'00$&').replace(/\b\d\d\b/g,'0$&') +' '+ (ip.replace(/\b[0-9]{1,2}\b/g, function(m){
return (m.length === 2 ? '0':'00') + m;
}))
);
if(results !== '001.000.022.123 001.000.022.123') console.warn('replace.replace + replace.function',results);
Ready to run.
Test | Ops/sec | |
---|---|---|
replace.replace |
| ready |
replace.function |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.