HTML Preparation code:
x
 
1
2
<div id='hello'>Hello, World!</div>
Script Preparation code:
 
let el = document.querySelector("#hello");
Tests:
  • innerText

     
    let i = 1000;
    let el = document.querySelector("#hello");
    while (i--) {
        el.innerText = "Goodbye, cruel world!"
    }
  • innerHtml

     
    let i = 1000;
    let el = document.querySelector("#hello");
    while (i--) {
        el.innerHtml = "Goodbye, cruel world!"
    }
  • innerText with Compare

     
    var g_DOMParser = new DOMParser();
    function decodeHTMLSymbols(htmlText) {
        return g_DOMParser.parseFromString(htmlText, "text/html").documentElement.textContent;
    }
    let i = 1000;
    let el = document.querySelector("#hello");
    while (i--) {
        if (el.innerHTML != decodeHTMLSymbols("Goodbye, cruel world!"))
        {
            el.innerHtml = "Goodbye, cruel world!"
        }
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    innerText
    innerHtml
    innerText with Compare

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0
Firefox 111 on Windows
View result in a separate tab
Test name Executions per second
innerText 382.6 Ops/sec
innerHtml 519536.8 Ops/sec
innerText with Compare 24.0 Ops/sec