HTML Preparation code:
AخA
 
1
<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");
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    style.setProperty
    style.cssText
    style
    attributeStyleMap.set

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Chrome 116 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
style.setProperty 561854.1 Ops/sec
style.cssText 773526.1 Ops/sec
style 677138.8 Ops/sec
attributeStyleMap.set 205414.1 Ops/sec