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
The main performance gains come from avoiding a lot of checking and function calls which jQuery does before getting to the filter function.
Also see: http://api.jquery.com/even-selector/#comment-87495095
<table id="outterTable">
<tbody>
<tr><td><p>(Row 1) This Says Something</p></td></tr>
<tr><td>(Row 1a) <select option/></td></tr>
<tr><td><p>(Row 2) This Says Something</p></td></tr>
<tr><td>(Row 2a) <select option/> </td></tr>
<tr><td><p>(Row 3) This Says Something</p></td></tr>
<tr><td>(Row 3a) <select option/></td></tr>
</tbody>
</table>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
(function($) {
$.fn.even = function() {
var el = [],
jQ = $();
jQ.context = this.context;
jQ.selector = this.selector;
for (var i = 1, l = this.length; i < l; i += 2)
el.push(this[i]);
jQ.push(el);
return jQ;
};
})(jQuery);
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
.even |
| ready |
:even |
| ready |
.filter function |
| ready |
.filter :even |
| ready |
.each |
| ready |
for |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.