Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
setAttribute vs style
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Android 13; Mobile; rv:137.0) Gecko/137.0 Firefox/137.0
Browser:
Firefox Mobile 137
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
setAttribute
8.2 Ops/sec
style
21.5 Ops/sec
HTML Preparation code:
<div id="foo"></div>
Tests:
setAttribute
var element = document.getElementById("foo"); var i = 10000; while (i--) { element.setAttribute("style", "width: "+i+"px; height: "+i+"px;"); }
style
var element = document.getElementById("foo"); var i = 10000; while (i--) { element.style.width = i+"px"; element.style.height = i+"px"; }