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 Difference Between [context].find([selector]).on([event]) and [context].on([event], [selector])
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
function handler() {
// Do something
temp += Math.random() / Math.random() / Math.random();
}
var $context = $('#context'),
$p = $context.find('p'),
temp;
ui.benchmarks[0].setup = function() {
temp = 0;
$context.on('click', 'p', handler);
};
ui.benchmarks[1].setup = function() {
temp = 0;
$context.find('p').on('click', handler);
};
</script>
<div id="context">
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>verylongcontents</p>
<p>Event test</p>
</div>
Ready to run.
Test | Ops/sec | |
---|---|---|
.on() in context |
| ready |
.find().on() |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.