Run details:
Mozilla/5.0 (Linux; Android 6.0.1; SAMSUNG SM-N910C) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/12.0 Chrome/79.0.3945.136 Mobile Safari/537.36
Chrome Mobile 79
Android 6.0.1
Mobile
3 years ago
Test name Executions per second
append 74.2 Ops/sec
insertAdjacentHTML 145.7 Ops/sec
HTML Preparation code:
AخA
 
1
<div id="test"></div>
Tests:
  • append

     
    var newElement = document.createElement("div");
    newElement.id = "testing"
    for (i = 0; i < 1000; i++) {
      var newElementPart = document.createElement("div");
      newElementPart.classList.add("testClass");
      newElement.append(newElementPart);
    }
    document.getElementById("test").append(newElement);
  • insertAdjacentHTML

     
    html = "<div id='testing'>"
    for (i = 0; i < 1000; i++) {
      html += "<div class='testClass'></div>";
    }
    html += "</div>";
    document.getElementById("test").insertAdjacentHTML("beforeend", html);