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 text = 'w gerg esr esb '
const removeUnicodeControlChars1 = (text) => {
if (!text) {
return text;
}
// Unicode control characters to remove
const controlChars = [
'\u202A', // LRE (Left-to-Right Embedding)
'\u202B', // RLE (Right-to-Left Embedding)
'\u202C', // PDF (Pop Directional Formatting)
'\u200E', // LRM (Left-to-Right Mark)
'\u200F', // RLM (Right-to-Left Mark)
'\u202D', // LRO (Left-to-Right Override)
'\u202E', // RLO (Right-to-Left Override)
];
let sanitized = text;
controlChars.forEach(char => {
sanitized = sanitized.replace(new RegExp(char, 'g'), '');
});
return sanitized;
}
const removeUnicodeControlChars2 = (text) => {
if (!text) {
return text;
}
return text.replace(/[\u202A\u202B\u202C\u202D\u202E\u200E\u200F]/g, '');
}Ready to run.
| Test | Ops/sec | |
|---|---|---|
| O(7n) | | ready |
| O(n) | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.