Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Text.data vs Text.nodeValue
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/109.0.0.0 Safari/537.36
Browser:
Chrome 109
Operating system:
Windows
Device Platform:
Desktop
Date tested:
9 months ago
Test name
Executions per second
Text.data
5851.7 Ops/sec
Text.nodeValue
6823.8 Ops/sec
Text.data with check against old value
3996.0 Ops/sec
Text.nodeValue with check against old value
3850.4 Ops/sec
Script Preparation code:
function randomString(length) { let result = ""; const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for (let i = 0; i < length; i++) { result += characters.charAt(Math.floor(Math.random() * characters.length)); } return result; } var randomStrings = Array.from({ length: 1000 }, () => randomString(100)); var text = document.createTextNode("");
Tests:
Text.data
for (const s of randomStrings) { text.data = s; }
Text.nodeValue
for (const s of randomStrings) { text.nodeValue = s; }
Text.data with check against old value
for (const s of randomStrings) { if (text.data !== s) { text.data = s; } }
Text.nodeValue with check against old value
for (const s of randomStrings) { if (text.nodeValue !== s) { text.nodeValue = s; } }