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
var format = "{container_id}-{client_id}-{vu_id}-{iteration_id}";
var CONTAINER_ID = "CONTAINER_ID";
var rpiclient_id = "rpiclient_id";
var execvuidInInstance = "execvuidInInstance";
var execvuiterationInInstance = "execvuiterationInInstance";
var scopes = ["email", "profile", "openid"].join("_")
var obj = {
container_id: CONTAINER_ID,
client_id: rpiclient_id,
vu_id: execvuidInInstance,
iteration_id: execvuiterationInInstance,
scopes: scopes,
};
function replaceMutiple(str) {
return str
.replace("{container_id}", CONTAINER_ID)
.replace("{client_id}", rpiclient_id)
.replace("{vu_id}", execvuidInInstance)
.replace("{iteration_id}", execvuiterationInInstance)
.replace("{scopes}", scopes);
}
function replaceRegex(str) {
return str
.replace(/\{([a-zA-Z_]+)\}/g, (match, token) => {
return obj[token] || "";
});
}
function replaceWhile(str) {
var outstr = "",
start = -1,
end = 0;
while ((end = str.indexOf("{", ++start)) > -1) {
outstr += str.slice(start, end);
start = end;
if ((end = str.indexOf("}", start)) > -1) {
outstr += (obj[str.slice(start + 1, end)] || "");
start = end;
}
}
return outstr + str.slice(start);
}
Ready to run.
Test | Ops/sec | |
---|---|---|
replaceMutiple |
| ready |
replaceRegex |
| ready |
replaceWhile |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.