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
Multiple regular expression .test() calls using if/else-if, or a single string.match() call. Modified to randomly grab a different string for every loop iteration, instead of using the same string for each test.
<script>
var q1RegExp = /^select hostheader,referer,firstbyte/;
var q2RegExp = /^select "Q1/;
var q3RegExp = /^select "Q2/;
var q4RegExp = /^select "Q3/;
var singleRegExp = /^select ("Q\d+|hostheader,referer,firstbyte)/;
var QueryNames = ['select hostheader,referer,firstbyte','select "Q1','select "Q2','select "Q3'];
var totalQueryNames = QueryNames.length;
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
regex.test() with if/else-if |
| ready |
string.match() with switch |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.