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 src="http://fuji.jetpants.com/yui/devcombo/yui3-dev?build/yui/yui-min.js&build/loader/loader-min.js"></script>
<script>
var Y = YUI({
comboBase: 'http://fuji.jetpants.com/yui/combo/yui3-dev?',
combine: true,
root: 'build/'
}).use('array-extras'),
states = ["Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Dakota", "North Carolina", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming"],
results;
// YUI3-style emulated each().
function each(a, f, o) {
var l = (a && a.length) || 0,
i;
for (i = 0; i < l; i = i + 1) {
f.call(o || this, a[i], i, a);
}
}
function map(array, callback, thisObject) {
var i = 0,
len = array.length,
results = [];
for (; i < len; ++i) {
results.push(callback.call(thisObject, array[i], i, array));
}
return results;
}
function map_dupe(array, callback, thisObject) {
var i = 0,
len = array.length,
results = array.concat();
for (; i < len; ++i) {
results[i] = callback.call(thisObject, array[i], i, array);
}
return results;
}
// YUI3-style emulated map().
function map_each(array, callback, thisObject) {
var results = [];
each(array, function(item, i, a) {
results.push(callback.call(thisObject, item, i, a));
});
return results;
}
function callback(item) {
return item + 'pants';
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Native map |
| ready |
Emulated map #1 (new array + push) |
| ready |
Emulated map #2 (dupe array + replace) |
| ready |
Emulated map #3 (YUI 3.2.0-style) |
| ready |
YUI3 dev build (native/emulated based on feature test) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.