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
<script>
var shift = Array.prototype.shift,
split = String.prototype.split,
r_period = /\./ig;
var traverse1 = function(json, namespace) {
var tree = split.call(namespace, r_period),
curr, val = json;
while ((curr = shift.call(tree))) {
val = val[curr];
}
return val;
};
var traverse2 = function(json, namespace) {
var tree = split.call(namespace, r_period),
tt = function(obj, keys) {
if (!keys || keys.length == 0) {
return obj;
}
return tt(obj[shift.call(keys)], keys);
};
return tt(json, tree);
};
var o = {
n: {
x: {
y: {
t: 0,
s: 1,
r: {
b: true
}
}
}
}
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
While loop |
| ready |
Recursive |
| ready |
Direct referencing via dot notation |
| ready |
Direct referencing via bracket notation |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.