DOMNodeInserted Performance

JavaScript performance comparison

Revision 4 of this test case created by Josh

Preparation code

<div id="parent"></div>
<div id="deafParent"></div>
Benchmark.prototype.setup = function() {
    var deafParent = document.getElementById('deafParent');
    var parent = document.getElementById('parent');
    var div = document.createElement("div");
    parent.addEventListener("DOMNodeInserted", function(e) {}, false);

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Append without event listener
Append with event listener

Compare results of other browsers


You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

1 comment

Josh commented :

I don't think anyone would advocate adding thousands of event listeners to the page. Rather, add the listener to the parent element, and the performance difference is actually minimal.

Comment form temporarily disabled.

Add a comment