Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
getComputedStyle - call + access variations.
(version: 1)
Comparing performance of:
Always compute vs Mostly compute vs Stash compute
Created:
one year ago
by:
Guest
Jump to the latest result
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();
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Always compute
Mostly compute
Stash compute
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:132.0) Gecko/20100101 Firefox/132.0
Browser/OS:
Firefox 132 on Mac OS X 10.15
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Always compute
4353609.5 Ops/sec
Mostly compute
4437836.0 Ops/sec
Stash compute
9229050.0 Ops/sec
Related benchmarks:
Closure vs arrow function
InAndOutScope
testtest132123asdasda
testtest132123asdasda2
Switch vs Object Literal largerestbest
Switch vs Object Literal largerestbestfixed
Closure vs arrow function fork
Function vs Eval vs Getter
Object length, Object Keys vs for loop
Comments
Confirm delete:
Do you really want to delete benchmark?