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 spaces = ' \f\n\r\t\v\u00A0\u2028\u2029';
const spaceSet = new Set(spaces);
function isSpaceSet(char) {
return spaceSet.has(char);
}
function isSpaceChar(char) {
return spaces.includes(char);
}
function isSpaceCharCode(char) {
const charCode = char.charCodeAt(0);
return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 ||
(charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279)));
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Use charCode comparison |
| ready |
Use String.includes |
| ready |
Use Set.has |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.