Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Object entries, values, keys, and Array.from
(version: 0)
Comparing performance of:
entries vs Values vs Keys vs Array.from
Created:
4 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
function makeid() { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for (var i = 0; i < 5; i++) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; } window.obj = {}; for (let i = 0; i < 100; i++) { window.obj[makeid()] = makeid(); }
Tests:
entries
const len = Object.entries(window.obj).length;
Values
const len = Object.values(window.obj).length;
Keys
const len = Object.keys(window.obj).length;
Array.from
const len = Array.from(window.obj).length;
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
entries
Values
Keys
Array.from
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:
IE11 Object.entries
Object values: Object.entries VS Object.keys VS Object.keys with extra array VS Object.entries without array VS Object values: Object.entries loop for
Object values: Object.entries VS Object.keys VS Object.keys with extra array VS Object.entries without array VS for .. of
Object.entries VS Object.keys VS Object.keys with extra array VS Object.entries without array VS Array
Object.entries VS Object.keys VS Object.keys with extra array VS Object.entries without array VS Object.keys as separate array with for loop
Comments
Confirm delete:
Do you really want to delete benchmark?