Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Object into variable vs Direct object access
(version: 0)
Comparing performance of:
Store into variable vs Access object
Created:
5 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var list = { test: 1 } var item = { name: 'test' } var count = 1000
Tests:
Store into variable
var isChecked = Boolean(list[item.name]) for (let i = 0; i < count; i++) { console.log(isChecked) console.log(isChecked) console.log(isChecked) }
Access object
for (let i = 0; i < count; i++) { console.log(Boolean(list[item.name])) console.log(Boolean(list[item.name])) console.log(Boolean(list[item.name])) }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Store into variable
Access object
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Variable assignment from object | traditional vs destructuring
object.assign vs spread to create a copy
Object.assign vs spreading object copy
object destruction vs. dot notation 2
object spread vs Object.assign
Comments
Confirm delete:
Do you really want to delete benchmark?