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://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script src="http://underscorejs.org/underscore-min.js">
</script>
<script>
var a = $('<div/>').append(Array(100).join('<a></a>')).find('a');
// My each2 plugin
(function($) {
var jq = $([]);
$.fn.each2 = function(fn) {
var i = -1;
while ((jq[0] = this[++i]) && fn.call(jq[0], i, jq) !== false) {}
return this;
};
})(jQuery);
(function($) {
var jq = $([]);
$.fn.each2_ref = function(fn) {
var i = -1,
elem;
while ((elem = jq[0] = this[++i]) && fn.call(elem, i, jq) !== false) {}
return this;
};
})(jQuery);
(function($) {
var jq = $([]);
$.fn.each2_len = function(fn) {
var i = -1,
len = this.length;
while (++i < len && (jq[0] = this[i]) && fn.call(jq[0], i, jq) !== false) {}
delete jq[0];
return this;
};
})(jQuery);
(function($) {
var jq = $([]);
$.fn.each2_ref_len = function(fn) {
var i = -1,
len = this.length,
elem;
while (++i < len && (elem = jq[0] = this[i]) && fn.call(elem, i, jq) !== false) {}
delete jq[0];
return this;
};
})(jQuery);
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
no elem ref, no explicit length comparison |
| ready |
elem ref, no explicit length comparison |
| ready |
no elem ref, explicit length comparison |
| ready |
elem ref, explicit length comparison |
| ready |
original jQuery.fn.each (reference) |
| ready |
underscore each |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.