Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
style.setProperty vs style.cssText vs style vs attributeStyleMap.set 2
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Browser:
Chrome 138
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
style.setProperty
1.1M/s
style.cssText
1.0M/s
style
911K/s
attributeStyleMap.set
359K/s
View exact numbers
Test name
Executions per second
✓
style.setProperty
1,100,697 Ops/sec
style.cssText
1,028,477 Ops/sec
style
911,375 Ops/sec
attributeStyleMap.set
358,691 Ops/sec
HTML Preparation code:
<div id="test"></div>
Script Preparation code:
el = document.getElementById("test"); style = el.style attributeStyleMap = el.attributeStyleMap
Tests:
style.setProperty
style.setProperty("color","red"); style.setProperty("border","1vmin solid red"); style.setProperty("padding","0.5vmin"); style.setProperty("background-color","black"); style.setProperty("height","1vh"); style.setProperty("width","1vw");
style.cssText
style.cssText = "color:red;border:1vmin solid red;padding:0.5vmin;background-color:black;height:1vh;width:1vw;";
style
el.style = "color:red;border:1vmin solid red;padding:0.5vmin;background-color:black;height:1vh;width:1vw;";
attributeStyleMap.set
attributeStyleMap.set("color","red"); attributeStyleMap.set("border","1vmin solid red"); attributeStyleMap.set("padding","0.5vmin"); attributeStyleMap.set("background-color","black"); attributeStyleMap.set("height","1vh"); attributeStyleMap.set("width","1vw");