normal and fragments

JavaScript performance comparison

Test case created by bipen

Preparation code

<div></div>

 

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
normal
var anchor,div = document.getElementsByTagName("div");
for (var i = 0; i < 10; i ++) {
    anchor = document.createElement('a');
    anchor.innerHTML = 'test';
    div[0].appendChild(anchor);
  }
pending…
fragment
var anchor,div = document.getElementsByTagName("div"),fragment = document.createDocumentFragment();
for (var i = 0; i < 10; i ++) {
    anchor = document.createElement('a');
    anchor.innerHTML = 'test';
    fragment.appendChild(anchor);
  }

div[0].appendChild(fragment);
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