Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Object.values() vs Array.from(Map.values())
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:146.0) Gecko/20100101 Firefox/146.0
Browser:
Firefox 146
Operating system:
Ubuntu
Device Platform:
Desktop
Date tested:
4 months ago
Test name
Executions per second
Object.values()
187730.8 Ops/sec
Array.from(Map.values())
105603.9 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
function generateID(length = 10) { const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; let result = ''; const charactersLength = characters.length; for (let i = 0; i < length; i++) { // Generate a random index based on characters length const randomIndex = Math.floor(Math.random() * charactersLength); // Append the character at the random index to the result string result += characters[randomIndex]; } return result; } const obj = {}; const map = new Map(); for (let i = 0; i < 1000; i++) { const id = generateID(); obj[id] = { key: id }; map.set(id, { key: id }); }
Tests:
Object.values()
const result = Object.values(obj);
Array.from(Map.values())
const result = Array.from(map.values());