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
combine a string with a prefix
const prefix = '_this_is_a_prefix_';
const strings_count = 1e6;
const string_short_length = 10;
const strings_short = [];
for(let s = 0; s < strings_count; ++s) {
strings_short.push(
(Math.random() + 1)
.toString(36)
.substring(string_short_length);
);
}
const string_medium_length = 100;
const strings_medium = [];
for(let s = 0; s < strings_count; ++s) {
strings_medium.push(
(Math.random() + 1)
.toString(36)
.substring(string_medium_length);
);
}
const string_long_length = 1000;
const strings_medium = [];
for(let s = 0; s < strings_count; ++s) {
strings_long.push(
(Math.random() + 1)
.toString(36)
.substring(string_long_length);
);
}
Ready to run.
| Test | Ops/sec | |
|---|---|---|
| short string with plus operator | | ready |
| short string with template string | | ready |
| medium string with plus operator | | ready |
| medium string with template string | | ready |
| long string with plus operator | | ready |
| long string with template string | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.