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 fnTemplate = (template, parameters) => {
const names = Object.keys(parameters);
const values = Object.values(parameters);
return new Function(...names, `return \`${template}\`;`)(...values);
};
const regexTemplate = (template, parameters) => {
return Object.entries(parameters).reduce(
(result, [arg, val]) => result.replace(`$\{${arg}}`, `${val}`),
template
);
};
const rawTemplate = (template, parameters) => {
let start = 0;
while((start = template.indexOf("${", start)) !== -1) {
let end = template.indexOf("}", start);
if(end === -1) {
break;
}
const name = template.slice(start + 2, end);
const value = String(parameters[name]);
template = template.slice(0, start) + value + template.slice(end + 1);
start += value.length;
}
return template;
}
Ready to run.
Test | Ops/sec | |
---|---|---|
function |
| ready |
regex |
| ready |
low |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.