Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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
Benchmark engine:
Benchmark.js
innerText with Compare
668K/s
innerHtml
386K/s
innerText
762/s
innerHtml with Compare
58/s
View exact numbers
Test name
Executions per second
✓
innerText with Compare
667,858 Ops/sec
innerHtml
385,864 Ops/sec
innerText
762 Ops/sec
innerHtml with Compare
58 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!" } }