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 APPROVED_FUNCTIONAL_WILDCARD_KEYS = [
{ pattern: /^dashboard_impressions-/, key: "dashboard_impressions-*" },
{
pattern: /^grafana\.dashboard\.editor\.ui\.optionGroup/,
key: "grafana.dashboard.editor.ui.optionGroup[*]",
},
{
pattern: /^grafana\.explore\.datasource/,
key: "grafana.explore.datasource.*",
},
{ pattern: /^grafana\.explore\.history/, key: "grafana.explore.history.*" },
{
pattern: /^grafana\.navigation\.expanded/,
key: "grafana.navigation.expanded[*]",
},
{ pattern: /^search\.sections/, key: "search.sections.*" },
];
const lookup = {};
APPROVED_FUNCTIONAL_WILDCARD_KEYS.forEach((wildcard) => {
lookup[wildcard.key] = { category: "functional" };
});
function isApprovedKey(key) {
for (const wildcard of APPROVED_FUNCTIONAL_WILDCARD_KEYS) {
// test the `key` argument against the pattern
if (wildcard.pattern.test(key)) {
// check for consent using the registered/approved wildcard key
return !!lookup[wildcard.key];
}
}
return false;
}
const lookup2 = new Set(APPROVED_FUNCTIONAL_WILDCARD_KEYS.map((wc) => wc.key));
function isApprovedKey2(key) {
return lookup2.has(key);
}
Ready to run.
Test | Ops/sec | |
---|---|---|
how long does it take to a pattern match an unknown key in a loop |
| ready |
how long does it take to a pattern match a known key in a loop |
| ready |
how long does it take to a pattern match an unknown key in a set |
| ready |
how long does it take to a pattern match a known key in a set |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.