attachEvent vs addEventListener

Benchmark created by Sashank Tadepalli on


Preparation HTML

<div id="test"></div>
<script>
  var z = document.getElementById("test");
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
attachEvent
document.attachEvent("click", function(){});
ready
addEventListener
document.addEventListener("click", function(){});
ready

Revisions

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