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
<script>
function splitRegex(str, len) {
var regex = new RegExp('.{1,' + len + '}', 'g');
return str.match(regex);
}
function splitSlice(str, len) {
var ret = [ ];
for (var offset = 0, strLen = str.length; offset < strLen; offset += len) {
ret.push(str.slice(offset, len + offset));
}
return ret;
}
function splitSubstring(str, len) {
var ret = [ ];
for (var offset = 0, strLen = str.length; offset < strLen; offset += len) {
ret.push(str.substr(offset, len));
}
return ret;
}
var shortString = 'abcdefg';
var longString = (new Array(500)).join('qwertyuiopasdfghjklzxcvbnm');
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Regex w/ Short String |
| ready |
Regex w/ Long String |
| ready |
Slice w/ Short String |
| ready |
Slice w/ Long String |
| ready |
Regex w/ Long String, Large Chunks |
| ready |
Slice w/ Long String, Large Chunks |
| ready |
Substring w/ Short String |
| ready |
Substring w/ Long String |
| ready |
Substring w/ Long String, Large Chunks |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.