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
Using arrays to push values and then joining them versus native string appending;
<script>
var iterations = 1000;
function array_join(val) {
var sb = [];
var i;
sb.length = iterations;
for (i = 0; i < iterations; ++i) {
sb[i] = val;
}
return sb.join();
}
function append(val) {
var str = '';
var i;
for (i = 0; i < iterations; ++i) {
str += val;
}
return str;
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
StringBuilder |
| ready |
append |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.