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
Test the performance of splitting a string only on the first delimitor
function test_single(path, split) {
let component, last;
while (path[0] === '/') path = path.slice(1);
for (;;) {
last = path;
[component, path] = split(path);
if (!path) break;
}
}
const test_paths = [
'/home/test/src/project/deps/libsomething/dist/file.js',
'//net/path/with/oops///slashes'
];
function test(split) {
for (const p of test_paths) test_single(p, split);
}Ready to run.
| Test | Ops/sec | |
|---|---|---|
| Regex with lastIndex | | ready |
| IndexOf, charCodeAt | | ready |
| Regex with indexes | | ready |
| IndexOf, strings | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.