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
Determining whether it is faster to use click(), bind(), delegate(), or live() on click events.
This version actually runs the event handlers, rather than simply binding them.
<div id="extra-dom-content">
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
</div>
<a href="#">Home</a>
<ul id="nav">
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
<li>
<a href="#" class="bind">DelegateLink</a>
</li>
<li>
<a href="#" class="delegate">NonDelegateLink</a>
</li>
<li>
<a href="#" class="live">NonDelegateLink</a>
</li>
</ul>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
/script
function fireEvent(element) {
element.trigger('click');
}
$(document).on('click', '.live', function(e) {
});
$('.bind').on('click', function(e) {
});
$('#nav').on('click', '.delegate', function(e) {
});
var bind = $('.bind');
var live = $('.live');
var delegate = $('.delegate');
Ready to run.
Test | Ops/sec | |
---|---|---|
Delegated |
| ready |
Live |
| ready |
Bind |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.