HTML Preparation code:
AخA
 
1
<div id='a'>foo</div>
2
<div id='b'>bar</div>
Script Preparation code:
 
var a = document.getElementById('a');
var b = document.getElementById('b');
Tests:
  • style

    x
     
    const fontSize = 20 * Math.random();
    a.style.fontSize = `${fontSize}px`;
    a.style.letterSpacing = `-${Math.random()}em`;
    a.style.wordSpacing = `${Math.random()}em`;
    a.style.lineHeight = `${Math.random()}`;
    a.style.textIndent = a.style.fontSize;
    const x = a.getBoundingClientRect();
  • style.cssText

     
    const fontSize = 20 * Math.random();
    b.style.cssText = `
      font-size: ${fontSize}px;
      letter-spacing: -${Math.random()}em;
      word-spacing: ${Math.random()}em;
      line-height: ${Math.random};
      textIndent: ${fontSize}px;
    `;
    const x = b.getBoundingClientRect();
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    style
    style.cssText

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Linux; Android 6.0.1; SM-G532M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Mobile Safari/537.36
Chrome Mobile 92 on Android 6.0.1
View result in a separate tab
Test name Executions per second
style 550.2 Ops/sec
style.cssText 654.7 Ops/sec