Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Converting Array to Object
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Browser:
Chrome 120
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Object.fromEntries()
53772.4 Ops/sec
Array.prototype.reduce()
190394.0 Ops/sec
Assignment
186014.1 Ops/sec
Script Preparation code:
var arr1 = [ [ "are", "relatively" ], [ "bodies", "that" ], [ "up", "of" ], [ "hot,", "glowing" ], [ "gases.", "They" ], [ "in", "the" ], [ "numbers", "throughout" ], [ "the", "beauty" ], [ "each", "one" ], [ "shining", "with" ], [ "its", "ever-changing" ], [ "unique", "brightness." ], [ "Stars", "also" ], [ "sizes,", "ranging" ], [ "from", "small" ], [ "and", "wonder" ], [ "to", "something" ], [ "They", "remind" ], [ "a", "clear" ], [ "role", "in" ], [ "serving", "as" ], [ "blocks", "of" ], [ "galaxies", "and" ], [ "of", "the" ], [ "for", "navigation," ], [ "on", "Earth." ], [ "have", "looked" ], [ "colors,", "which" ], [ "indicate", "their" ], [ "temperature", "and" ], [ "age.", "Some" ], [ "stars,", "with" ], [ "our", "modern" ], [ "close", "to" ], [ "us,", "while" ], [ "others", "are" ], [ "billions", "of" ], [ "light-years", "away," ], [ "making", "them" ], [ "appear", "as" ], [ "tiny", "points" ], [ "night", "or" ], [ "The", "moon" ], [ "known", "as" ], [ "astronomy,", "allows" ], [ "us", "to" ], [ "learn", "more" ], [ "about", "the" ], [ "universe", "and" ], [ "within", "it." ], [ "since", "the" ], [ "beginning", "of" ], [ "time.", "These" ], [ "celestial", "bodies" ], [ "countless", "myths," ], [ "stories,", "and" ], [ "poems.", "The" ], [ "their", "twinkling" ], [ "light,", "have" ], [ "been", "a" ], [ "helping", "sailors" ], [ "find", "their" ], [ "way", "in" ], [ "world.", "They" ], [ "source", "of" ], [ "guidance", "and" ], [ "hope", "for" ], [ "those", "lost" ], [ "darkness.", "The" ], [ "moon,", "with" ], [ "glow,", "has" ], [ "cultures.", "It" ], [ "has", "also" ], [ "worshiped", "as" ], [ "with", "all" ], [ "symbol", "of" ], [ "change", "and" ], [ "transformation,", "with" ], [ "shape", "and" ], [ "influence", "on" ], [ "tides", "and" ], [ "nature.", "Throughout" ], [ "history,", "people" ], [ "stars", "on" ], [ "moon", "rise" ], [ "answers", "and" ], [ "guidance,", "seeking" ], [ "universe.", "And" ], [ "even", "today," ], [ "technology", "and" ], [ "knowledge,", "the" ], [ "remind", "us" ], [ "small", "place" ], [ "vastness", "of" ], [ "look", "beyond" ], [ "ourselves", "and" ], [ "world", "around" ], [ "us.", "Whether" ], [ "it's", "gazing" ], [ "at", "the" ], [ "watching", "the" ], [ "over", "the" ], [ "horizon,", "these" ], [ "connect", "us" ], [ "greater", "and" ], [ "awe-inspiring", "power" ] ]
Tests:
Object.fromEntries()
Object.fromEntries(arr1)
Array.prototype.reduce()
arr1.reduce((accumulator, currentValue) => { accumulator[currentValue[0]] = currentValue[1] return accumulator }, {})
Assignment
const obj = {} arr1.forEach((value) => { obj[value[0]] = value[1] })