domConstruct vs innerHtml

Benchmark created by prashant sheoran on


Description

Comparing Dojo/dom-construt.toDom method and setting InnerHtml directly

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojo/dojo.js"></script>
<div id='box'></div>

Setup

require(['dojo/dom-construct', 'dojo/dom'], function(domconstruct, dom) {
      dDomconstruct = domconstruct;
      dDom = dom;
      box = document.getElementById('box');
    });

Teardown


    while (box.firstChild) {
      box.removeChild(box.firstChild);
    }
  

Test runner

Ready to run.

Testing in
TestOps/sec
domConstruct
var node = dDomconstruct.toDom("<div>Test</div>");
box.appendChild(node);
ready
innerHTML
box.innerHTML = '<div>Test</div>';
ready

Revisions

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

  • Revision 1: published by prashant sheoran on