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="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.2/lodash.min.js"></script>
<script src="http://dl.dropbox.com/u/513327/lodash.js"></script>
<script>
(function() {
var forEach2 = _.noConflict().forEach;
_.forEach2 = forEach2;
}());
_.forEach3 = (function() {
var propertyIsEnumerable = {}.propertyIsEnumerable,
nativeKeys = Object.keys;
function createCallback(func, thisArg, accumulating) {
if (!func) {
return identity;
}
if (typeof func != 'function') {
return function(object) {
return object[func];
};
}
if (typeof thisArg != 'undefined') {
if (accumulating) {
return function(accumulator, value, index, object) {
return func.call(thisArg, accumulator, value, index, object);
};
}
return function(value, index, object) {
return func.call(thisArg, value, index, object);
};
}
return func;
}
return function(collection, callback, thisArg) {
var index, iteratee = collection, result = collection;
if (!collection) return result;
callback = callback && typeof thisArg == 'undefined' ? callback : createCallback(callback, thisArg);
var length = iteratee.length; index = -1;
if (typeof length == 'number') {
while (++index < length) {
if (callback(iteratee[index], index, collection) === false)
return result;
}
}
else {
var skipProto = typeof iteratee == 'function' &&
propertyIsEnumerable.call(iteratee, 'prototype');
var ownIndex = -1,
ownProps = objectTypes[typeof iteratee] ? nativeKeys(iteratee) : [],
length = ownProps.length;
while (++ownIndex < length) {
index = ownProps[ownIndex];
if (!(skipProto && index == 'prototype')) {
if (callback(iteratee[index], index, collection) === false)
return result;
}
}
}
return result;
};
}());
</script>
var _ = window._;
var array = Array(101).join('x').split('');
Ready to run.
Test | Ops/sec | |
---|---|---|
_.every |
| ready |
_.forEach |
| ready |
_.forEach2 |
| ready |
_.forEach3 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.