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:
9 months ago
Test name
Executions per second
style.setProperty
1100696.9 Ops/sec
style.cssText
1028477.0 Ops/sec
style
911375.2 Ops/sec
attributeStyleMap.set
358690.8 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");