Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Map Code1
(version: 0)
Comparing performance of:
innerText vs textContent
Created:
6 years ago
by:
Guest
Jump to the latest result
Tests:
innerText
const places = [ [-95.712891, 37.09024, "United States", "76.9 million visitors"], [-106.346771, 56.130367, "Canada", "76.9 million visitors"], [-102.552788, 23.634501, "Mexico", "76.9 million visitors"], [-51.925282, -14.235004, "Brazil", "76.9 million visitors"], [-63.616673, -38.416096, "Argentina", "76.9 million visitors"], [25.748152, 61.92411, "Finland", "76.9 million visitors"], [-3.435973, 55.378052, "United Kingdom", "76.9 million visitors"], [10.451526, 51.165691, "Germany", "76.9 million visitors"], [12.56738, 41.871941, "Italy", "76.9 million visitors"], [35.24332, 38.963745, "Turkey", "76.9 million visitors"], [-3.74922, 40.463669, "Spain", "76.9 million visitors"], [22.937506, -30.559483, "South Africa", "76.9 million visitors"], [46.869106, -18.766947, "Madagascar", "76.9 million visitors"], [103.846657, 46.862495, "Mongolia", "76.9 million visitors"], [78.962883, 20.593683, "India", "76.9 million visitors"], [138.25293, 36.204823, "Japan", "76.9 million visitors"], [100.992538, 15.870032, "Thailand", "76.9 million visitors"], [80.771797, 7.873054, "Sri Lanka", "76.9 million visitors"], [101.975769, 4.210484, "Malaysia", "76.9 million visitors"], [133.775131, -25.274399, "Australia", "76.9 million visitors"], [174.885971, -40.900558, "New Zealand", "76.9 million visitors"] ]; for (let i = 0; i < places.length; i++) { let marker = document.createElement("div"); marker.className = "main-marker"; let tooltip = document.createElement("div"); tooltip.className = "tooltip"; let placeName = document.createElement("p"); placeName.innerText = places[i][2]; tooltip.appendChild(placeName); let placeVisitors = document.createElement("span"); placeVisitors.innerText = places[i][3]; tooltip.appendChild(placeVisitors); let icomoon = document.createElement("i"); icomoon.className = "icon icon-ic-location"; marker.appendChild(tooltip); marker.appendChild(icomoon); }
textContent
const places = [ [-95.712891, 37.09024, "United States", "76.9 million visitors"], [-106.346771, 56.130367, "Canada", "76.9 million visitors"], [-102.552788, 23.634501, "Mexico", "76.9 million visitors"], [-51.925282, -14.235004, "Brazil", "76.9 million visitors"], [-63.616673, -38.416096, "Argentina", "76.9 million visitors"], [25.748152, 61.92411, "Finland", "76.9 million visitors"], [-3.435973, 55.378052, "United Kingdom", "76.9 million visitors"], [10.451526, 51.165691, "Germany", "76.9 million visitors"], [12.56738, 41.871941, "Italy", "76.9 million visitors"], [35.24332, 38.963745, "Turkey", "76.9 million visitors"], [-3.74922, 40.463669, "Spain", "76.9 million visitors"], [22.937506, -30.559483, "South Africa", "76.9 million visitors"], [46.869106, -18.766947, "Madagascar", "76.9 million visitors"], [103.846657, 46.862495, "Mongolia", "76.9 million visitors"], [78.962883, 20.593683, "India", "76.9 million visitors"], [138.25293, 36.204823, "Japan", "76.9 million visitors"], [100.992538, 15.870032, "Thailand", "76.9 million visitors"], [80.771797, 7.873054, "Sri Lanka", "76.9 million visitors"], [101.975769, 4.210484, "Malaysia", "76.9 million visitors"], [133.775131, -25.274399, "Australia", "76.9 million visitors"], [174.885971, -40.900558, "New Zealand", "76.9 million visitors"] ]; for (let i = 0; i < places.length; i++) { let marker = document.createElement("div"); marker.className = "main-marker"; let tooltip = document.createElement("div"); tooltip.className = "tooltip"; let placeName = document.createElement("p"); placeName.textContent = places[i][2]; tooltip.appendChild(placeName); let placeVisitors = document.createElement("span"); placeVisitors.textContent = places[i][3]; tooltip.appendChild(placeVisitors); let icomoon = document.createElement("i"); icomoon.className = "icon icon-ic-location"; marker.appendChild(tooltip); marker.appendChild(icomoon); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
innerText
textContent
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
**Benchmark Overview** The provided benchmark measures the performance of two similar strings in different browsers: `textContent` and `innerText`. Both strings contain country names, each followed by a visitor count. **String Comparison** Both strings are identical: 1. "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" 2. "Chrome 79" 3. "Desktop" 4. "Windows" The difference lies in the property used to access these strings: 1. `textContent`: uses the `textContent` property to set and retrieve the string value. 2. `innerText`: uses the `innerHTML` property, which includes HTML tags, or the `innerText` property directly (if available). **Performance Comparison** According to the latest benchmark results, both browsers (`Chrome 79`) perform similarly for both properties: 1. `textContent`: average execution frequency per second: 5124.26 2. `innerText`: average execution frequency per second: 4926.26 The difference is relatively small (0.56%), indicating that accessing these strings using either property does not significantly impact performance in this specific benchmark. **Conclusion** In summary, the performance of both `textContent` and `innerText` properties is similar when used to access identical strings. The choice between these properties depends on the specific requirements of your application, such as readability or HTML rendering considerations.
Related benchmarks:
Map vs ImmutableJs copy
Map get Vs Map has get - V2
merge maps big
Comparison of three map functions
POJOs vs Immutable Maps
Comments
Confirm delete:
Do you really want to delete benchmark?