Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
window.getComputedStyle vs. getBoundingClientRect vs clientHeight
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0
Browser:
Firefox 128
Operating system:
Ubuntu
Device Platform:
Desktop
Date tested:
2 years ago
clientheight
818/s
getBoundingClientRect
369/s
getComputedStyle
213/s
View exact numbers
Test name
Executions per second
✓
clientheight
818 Ops/sec
getBoundingClientRect
369 Ops/sec
getComputedStyle
213 Ops/sec
HTML Preparation code:
<div id="foo"></div>
Tests:
getComputedStyle
var i = 5000; while (i--) { checkDisplay('foo'); } function checkDisplay(id) { return window.getComputedStyle(document.getElementById(id), null).getPropertyValue("display") === "none"; }
getBoundingClientRect
var i = 5000; while (i--) { checkDisplay('foo'); } function checkDisplay(id) { return document.getElementById(id).getBoundingClientRect().width === 0; }
clientheight
var i = 5000; while (i--) { checkDisplay('foo'); } function checkDisplay(id) { return document.getElementById(id).clientHeight === 0; }