Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.3 Safari/605.1.15
Safari 12
Mac OS X 10.13.6
Desktop
6 years ago
Test name Executions per second
createElement 4.8 Ops/sec
cloneNode 13.3 Ops/sec
Tests:
  • createElement

    AخA
     
    var list = [],
        n = 0;
    while(true) {
        n++;
        list.push(document.createElement('div'));
        list[list.length-1].appendChild(document.createElement('div'));
        list[list.length-1].appendChild(document.createElement('div'));
        if(n===100000) 
            break;
    }
  • cloneNode

     
    var list = [],
        n = 0,
        node = document.createElement('div');
    node.appendChild(document.createElement('div'));
    node.appendChild(document.createElement('div'));
    while(true) {
        n++;
        list.push(node.cloneNode(true));
        if(n===100000) 
            break;
    }