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
string.replace() will return the string if it doesn't match. But the regex slows it down.
"Guarding" the replace with an indexOf check will be about 80% faster!
var name = 'bla'
var name2 = 'bla.2'
var fieldArrayIndex = -1
var fieldName = ''
Ready to run.
Test | Ops/sec | |
---|---|---|
Without indexOf |
| ready |
With indexOf |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.