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

    x
     
    var i = 5000;
    const node = document.getElementById('foo')
    while (i--) {
        checkDisplay('foo');
    }
    function checkDisplay(id) {
        return parseFloat(window.getComputedStyle(node).height) > 0;
    }
  • getBoundingClientRect

     
    var i = 5000;
    const node = document.getElementById('foo')
    while (i--) {
        checkDisplay('foo');
    }
    function checkDisplay(id) {
        return node.getBoundingClientRect().height > 0;
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    getComputedStyle
    getBoundingClientRect

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0
Firefox 105 on Windows
View result in a separate tab
Test name Executions per second
getComputedStyle 193.8 Ops/sec
getBoundingClientRect 360.3 Ops/sec