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
Checks performance of various string repeat algorithms
var expected = new Array(950).join('foo');
function bitShift(str, n) {
if (n < 1) return '';
var result = '';
while (n > 0) {
if (n & 1) result += str;
n >>= 1;
str += str;
}
return result;
}
function concat(str, n) {
var result = '';
while (n-- > 0) {
result += str;
}
return result;
}
function join(str, n) {
return new Array(n + 1).join(str);
}
function push(str, n) {
var arr = [];
while (n-- > 0) {
arr.push(str);
}
return arr.join('');
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Regular string concatenation |
| ready |
Join array with empty values |
| ready |
Join prepopulated array |
| ready |
Special bit shifting algorithm |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.