HTML Preparation code:
AخA
 
1
<div id="foo"></div>
Tests:
  • getComputedStyle

    x
     
    var i = 5000;
    while (i--) {
        checkDisplay('foo');
    }
    function checkDisplay(id) {
        return window.getComputedStyle(document.getElementById(id), null).getPropertyValue("height").slice(0, -2);
    }
  • getBoundingClientRect

     
    var i = 5000;
    while (i--) {
        checkDisplay('foo');
    }
    function checkDisplay(id) {
        return document.getElementById(id).getBoundingClientRect().height;
    }
  • clientHeight

     
    var i = 5000;
    while (i--) {
        checkDisplay('foo');
    }
    function checkDisplay(id) {
        return document.getElementById(id).clientHeight;
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    getComputedStyle
    getBoundingClientRect
    clientHeight

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 days ago)
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Mobile Safari/537.36 EdgA/134.0.0.0
Chrome Mobile 134 on Android
View result in a separate tab
Test name Executions per second
getComputedStyle 20.5 Ops/sec
getBoundingClientRect 59.4 Ops/sec
clientHeight 102.9 Ops/sec