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 colspan="3"><p>(Row 1) This Says Something</p></td></tr>
<tr><td colspan="3">(Row 1a) <select option/></td></tr>
<tr><td colspan="3"><p>(Row 2) This Says Something</p></td></tr>
<tr><td colspan="3">(Row 2a) <select option/> </td></tr>
<tr><td colspan="3"><p>(Row 3) This Says Something</p></td></tr>
<tr><td colspan="3">(Row 3a) <select option/></td></tr>
<tr><td>aaa</td><td>bbb</td><td>ccc</td></tr>
<tr><td>aaa</td><td>bbb</td><td>ccc</td></tr>
<tr><td>aaa</td><td>bbb</td><td>ccc</td></tr>
<tr><td>aaa</td><td>bbb</td><td>ccc</td></tr>
<tr><td>aaa</td><td>bbb</td><td>ccc</td></tr>
<tr><td>aaa</td><td>bbb</td><td>ccc</td></tr>
<tr><td>aaa</td><td>bbb</td><td>ccc</td></tr>
<tr><td>aaa</td><td>bbb</td><td>ccc</td></tr>
<tr><td>aaa</td><td>bbb</td><td>ccc</td></tr>
<tr><td>aaa</td><td>bbb</td><td>ccc</td></tr>
</tbody>
</table>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
(function($) {
$.fn.even = function() {
var jQ = $();
jQ.context = this.context;
jQ.selector = this.selector;
for (var i = j = 0, l = this.length; i < l; i += 2, j++)
jQ[j] = this[i];
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.