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 match on a number, rather than a string, and to test 6 regular expressions, instead of 4.
<script>
var q1RegExp = /^select istream "Q1/;
var q2RegExp = /^select istream "Q2/;
var q3RegExp = /^select istream "Q3/;
var q4RegExp = /^select istream "Q4/;
var q5RegExp = /^select istream "Q5/;
var q6RegExp = /^select istream "Q6/;
var singleRegExp = /^select istream "Q(\d+)/;
var QueryNames = ['select istream "Q1','select istream "Q2','select istream "Q3','select istream "Q4','select istream "Q5','select istream "Q6'];
var totalQueryNames = QueryNames.length;
</script>
var QueryIndex = Math.floor(Math.random()*totalQueryNames);
var QueryName = QueryNames[QueryIndex];
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.