dom-vs-ccf

JavaScript performance comparison

Revision 4 of this test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    (function() {
      var doc = document;
      window.usingCCF = function(html) {
        var element = doc.createElement("div");
        var range = doc.createRange();
        range.setStart(element, 0);
        range.collapse(false);
        return range.createContextualFragment(html);
      }
   
      window.usingPrecompiler = function(document) {
        var frag = element0 = doc.createDocumentFragment();
        var element1 = el = doc.createElement('div');
        el.className = 'foo';
        var element2 = el = doc.createElement('p');
        var element3 = el = doc.createElement('span');
        el.id = 'bar';
        element3.text = 'hi!';
        element2.appendChild(element3);
        element1.appendChild(element2);
        element0.appendChild(element1);
        element0.text = ' More content';
        return frag;
      }
    })();
};
</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
ccf
var html = '<div class="foo">';
var hi = 'hi!';
html += '<p>';
html += '<span id="bar">';
html += hi;
html += '</span>';
html += '</p>';
html += '</div>';
html += ' More content';
usingCCF(html);
pending…
precompiler
usingPrecompiler();
pending…

Compare results of other browsers

Revisions

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:

0 comments

Add a comment