one vs multiple events

JavaScript performance comparison

Test case created by Josh

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var a = document.createElement('a');
    a.addEventListener('click', function () {
    }, false);
    a.addEventListener('click', function () {
    }, false);
   
    var b = document.createElement('a');
    b.addEventListener('click', function () {
    }, false);
   
   
    var event = document.createEvent('HTMLEvents');
    event.initEvent('click', true, true);
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
multiple events
a.dispatchEvent(event);
pending…
one event
b.dispatchEvent(event);
pending…

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

Compare results of other browsers

0 comments

Add a comment