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 getFlagEmoji1 = (countryCode: string) => {
const upCased = countryCode.toUpperCase();
const codePoints = new Array<number>(upCased.length);
for (let i = 0; i < upCased.length; i++) {
codePoints[i] = 127397 + upCased.charCodeAt(i);
}
return String.fromCodePoint(...codePoints);
};
function getFlagEmoji2(countryCode) {
return [...countryCode.toUpperCase()].map(char =>
String.fromCodePoint(127397 + char.charCodeAt())
).reduce((a, b) => `${a}${b}`);
}
function getFlagEmoji3(countryCode) {
const codePoints = countryCode
.toUpperCase()
.split('')
.map(char => 127397 + char.charCodeAt());
return String.fromCodePoint(...codePoints);
}
Ready to run.
Test | Ops/sec | |
---|---|---|
1 |
| ready |
2 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.