Event Performance

Benchmark created by GU Yiling on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="target"></div>

Setup

function task() {};
  var el = document.getElementById('target');
  var $el = $(el);

Test runner

Ready to run.

Testing in
TestOps/sec
Naive jQuery.on
$el.on('click', task);
ready
addEventListener
el.addEventListener('click', task);
ready
addEventListener with new callback
el.addEventListener('click', function () {});
ready
Naive jQuery.on with new callback
$el.on('click', function () {});
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by GU Yiling on