Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
getBoundingClientRect width vs offset width
(version: 1)
Comparing performance of:
getBoundingClientRect vs Access offset properties directly
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<div id="el" style="transform: rotateZ(45deg)"> <h2>Lorem ipsum dolor sit amet</h2> </div>
Script Preparation code:
const el = document.getElementById("el");
Tests:
getBoundingClientRect
const width = el.getBoundingClientRect().width;
Access offset properties directly
const width = el.offsetWidth;
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
getBoundingClientRect
Access offset properties directly
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
5 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
Browser/OS:
Chrome 142 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
getBoundingClientRect
1262628.8 Ops/sec
Access offset properties directly
2042353.0 Ops/sec
Related benchmarks:
offsetTop pref
offsetWidth / offsetHeight vs. getBoundingClientRect()
getBoundingClientRect vs offset when taking into account CSS transformation
getBoundingClientRect vs offset
offsetWidth vs. getBoundingClientRect().width
getBoundingClientRect vs offset performance
getBoundingClientRect vs offsetLeft
offsetWidth / offsetHeight vs. getBoundingClientRect() vs. clientWidth / clientHeight
offsetWidth vs getBoundingClientRect1
Comments
Confirm delete:
Do you really want to delete benchmark?