Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
clientHeight vs offsetHeight vs getComputedStyle
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0
Browser:
Firefox 147
Operating system:
Windows
Device Platform:
Desktop
Date tested:
4 months ago
Test name
Executions per second
clientHeight
6361117.0 Ops/sec
offsetHeight
5424632.5 Ops/sec
window.getComputedStyle
1866810.9 Ops/sec
Multiple: Only _style
1257993.5 Ops/sec
Multiple: _style e clientHeight
1263070.8 Ops/sec
HTML Preparation code:
<div id="teste">teste</div>
Tests:
clientHeight
document.getElementById('teste').clientHeight;
offsetHeight
document.getElementById('teste').offsetHeight;
window.getComputedStyle
parseFloat(window.getComputedStyle(document.getElementById('teste'))['height'])
Multiple: Only _style
let style1 = window.getComputedStyle(document.getElementById('teste')) parseFloat(style1['margin-top']) parseFloat(style1['margin-bottom']) parseFloat(style1['height'])
Multiple: _style e clientHeight
let style2 = window.getComputedStyle(document.getElementById('teste')) parseFloat(style2['margin-top']) parseFloat(style2['margin-bottom']) document.getElementById('teste').clientHeight;