Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
innerHTML vs innerText vs compare innerHTML vs compare innerText
blah blah
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0
Browser:
Firefox 123
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
innerText
761.8 Ops/sec
innerHtml
385864.5 Ops/sec
innerText with Compare
667857.8 Ops/sec
innerHtml with Compare
57.5 Ops/sec
HTML Preparation code:
<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
let i = 1000; let el = document.querySelector("#hello"); while (i--) { if (el.innerHtml != "Goodbye, cruel world!") { el.innerHtml = "Goodbye, cruel world!" } }
innerHtml 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!" } }