Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
window.getComputedStyle vs. getBoundingClientRect vs clientHeight vs elementFromPoint
(version: 1)
Comparing performance of:
getComputedStyle vs getBoundingClientRect vs clientheight vs elementFromPoint
Created:
3 months ago
by:
Guest
Jump to the latest result
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; }
elementFromPoint
var i = 5000; while (i--) { checkDisplay('foo'); } function checkDisplay(id) { return document.elementFromPoint(100, 100) !== null; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
getComputedStyle
getBoundingClientRect
clientheight
elementFromPoint
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0
Browser/OS:
Firefox 147 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
getComputedStyle
249.0 Ops/sec
getBoundingClientRect
7.1 Ops/sec
clientheight
769.2 Ops/sec
elementFromPoint
100.8 Ops/sec
Related benchmarks:
window.getComputedStyle vs. getBoundingClientRect
Get precise height : getComputedStyle vs getBoundingClientRect vs innerHeight
window.getComputedStyle vs. getBoundingClientRect vs clientHeight
window.getComputedStyle vs. getBoundingClientRect vs. window.getComputedStyle without getters
window.getComputedStyle vs. clientHeight
window.getComputedStyle vs. getBoundingClientRect width calculation
window.getComputedStyle vs. getBoundingClientRect 1111
Get precise height : getComputedStyle vs getBoundingClientRect vs innerHeight no slice
window.getComputedStyle vs. getBoundingClientRect get width
Comments
Confirm delete:
Do you really want to delete benchmark?