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
function includesUserAgentDataBrandOld(brand) {
try {
let result = false;
(() => {
if(navigator.userAgentData) {
// @ts-ignore: AUTO-IGNORING ALL ERRORS
for (let i = 0; i < navigator?.userAgentData.brands.length; i++) {
// @ts-ignore: AUTO-IGNORING ALL ERRORS
if (navigator.userAgentData.brands[i].brand == brand) {
result = true;
break;
}
}
}
})();
return result;
} catch ($$e_2) {
return false;
}
}
function includesUserAgentDataBrandNew(brand) {
return window.navigator.userAgentData?.brands.some(
(b) => b.brand === brand
) ?? false;
}
function includesUserAgentDataBrandShortCircuit(brand) {
return navigator.userAgentData && window.navigator.userAgentData.brands.some(
(b) => b.brand === brand
);
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Before |
| ready |
After |
| ready |
Short Circuit |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.