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
const testStr = "Hello <world> & \"quotes\" \u2028 new line \u2029 done.".repeat(10000);
const forbiddenChars = {
'<': '\\u003C',
'>': '\\u003E',
'"': '\\u0022',
'&': '\\u0026',
'\u2028': '\\u2028',
'\u2029': '\\u2029',
};
const forbiddenRe = /[<>&"\u2028\u2029]/g;
Ready to run.
| Test | Ops/sec | |
|---|---|---|
| Variant 1: Regex with external function | | ready |
| Variant 2: Regex inline | | ready |
| Variant 3: Loop + string concat | | ready |
| Variant 4: Loop + array join | | ready |
| Variant 5: Regex.test + Regex replace | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.