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 native checked property obviously should be faster than jQuery's methods, but I'm curious to see by how much of a margin and which of jQuery's ways is fastest.
Note: I'm not bothering with the attr method since it corresponds to the initial state and not the running state of the checkbox.
<div id="container"></div><script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
var $container = $('#container');
var $checkbox = $('<input type="checkbox"/>').appendTo($container);
var checkbox = $checkbox.get(0);
$container.empty();
Ready to run.
Test | Ops/sec | |
---|---|---|
Native |
| ready |
jQuery is |
| ready |
jQuery prop |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.