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
Usually .match and .indexOf are used in condition statements where the result of both of these has to be converted to a boolean. Since one of these returns an array (or null) and another returns a number, it would be more useful if we also included the cost of converting these results to a boolean in the final result.
Also, .match returns either an array or a null, which have different conversion costs. So added negative tests as well.
<script>
var str = "hello world!";
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Regexp Positive |
| ready |
indexOf Positive |
| ready |
Regexp Negative |
| ready |
indexOf Negative |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.