Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
affectation : innerHTML vs textContent vs Element vs true
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Browser:
Chrome 121
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
true
225.9M/s
Element
30.6M/s
textContent
4.6M/s
innerHTML
1.3M/s
View exact numbers
Test name
Executions per second
✓
true
225,861,136 Ops/sec
Element
30,591,860 Ops/sec
textContent
4,609,290 Ops/sec
innerHTML
1,307,419 Ops/sec
HTML Preparation code:
<button id="button"> <p>This is the text of my Button</p> <template> <p style="color:red;">This is a template text</p> <p>So much things here</p> </template> </button>
Script Preparation code:
var BUTTON = document.querySelector('#button');
Tests:
innerHTML
const a = BUTTON.innerHTML;
textContent
const b = BUTTON.textContent;
Element
const c = BUTTON;
true
const d = true;