Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
getComputedStyle - call + access variations.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:132.0) Gecko/20100101 Firefox/132.0
Browser:
Firefox 132
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
one year ago
Stash compute
9.2M/s
Mostly compute
4.4M/s
Always compute
4.4M/s
View exact numbers
Test name
Executions per second
✓
Stash compute
9,229,050 Ops/sec
Mostly compute
4,437,836 Ops/sec
Always compute
4,353,610 Ops/sec
HTML Preparation code:
<style type="text/css"> .ok { gap: 20px } </style> <div class="ok"><div>one</div><div>two</div></div>
Script Preparation code:
var okThen = document.querySelector('.ok'); var alwaysGet = (function () { return function () { return window.getComputedStyle(okThen, null).columnGap || window.getComputedStyle(okThen, null).gap; } })(); var mostlyGet = (function () { return function () { var got = window.getComputedStyle(okThen, null); return got.columnGap || got.gap; } })(); var stashGet = (function () { var got; return function () { got = got || window.getComputedStyle(okThen, null); return got.columnGap || got.gap; } })();
Tests:
Always compute
alwaysGet();
Mostly compute
mostlyGet();
Stash compute
stashGet();