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
polishCharMap = new Map([
['ś', 's'], ['ź', 'z'], ['ż', 'z'], ['ć', 'c'],
['ą', 'a'], ['ę', 'e'], ['ó', 'o'], ['ł', 'l'], ['ń', 'n'],
['Ś', 'S'], ['Ź', 'Z'], ['Ż', 'Z'], ['Ć', 'C'],
['Ą', 'A'], ['Ę', 'E'], ['Ó', 'O'], ['Ł', 'L'], ['Ń', 'N'],
])
polishCharsRegex = new RegExp(`[${Array.from(polishCharMap.keys()).join('')}]`,
'g')
polishCharObj = {
'ś': 's', 'ź': 'z', 'ż': 'z', 'ć': 'c',
'ą': 'a', 'ę': 'e', 'ó': 'o', 'ł': 'l', 'ń': 'n',
'Ś': 'S', 'Ź': 'Z', 'Ż': 'Z', 'Ć': 'C',
'Ą': 'A', 'Ę': 'E', 'Ó': 'O', 'Ł': 'L', 'Ń': 'N',
}
polishCharsArr= [
[ `ś`, `s` ],
[ `ź`, `z` ],
[ `ż`, `z` ],
[ `ć`, `c` ],
[ `ą`, `a` ],
[ `ę`, `e` ],
[ `ó`, `o` ],
[ `ł`, `l` ],
[ `ń`, `n` ],
// ------------
[ `Ś`, `S` ],
[ `Ź`, `Z` ],
[ `Ż`, `Z` ],
[ `Ć`, `C` ],
[ `Ą`, `A` ],
[ `Ę`, `E` ],
[ `Ó`, `O` ],
[ `Ł`, `L` ],
[ `Ń`, `N` ],
]
replacePolishCharactersT2 = (text) => {
return text.replace(polishCharsRegex, match => polishCharObj[match])
}
replacePolishCharactersT4 = (text) => {
return text.replace(polishCharsRegex, match => polishCharMap.get(match) || match)
}
Ready to run.
| Test | Ops/sec | |
|---|---|---|
| on split | | ready |
| old style | | ready |
| on regex | | ready |
| upgrade v2 | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.