Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Map vs Object new
my own
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser:
Chrome 136
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
GetFromArray
867.4 Ops/sec
GetFromMap
880.6 Ops/sec
Script Preparation code:
var arr = [{ code: "a", status: "1" }, { code: "b", status: "2" }, { code: "c", status: "3" }, { code: "d", status: "4" }, { code: "e", status: "5" }, { code: "f", status: "6" }, { code: "g", status: "7" }, { code: "h", status: "8" } ] var arrForMap = [ ["a", "1"], ["b", "2"], ["c", "3"], ["d", "4"], ["e", "5"], ["f", "6"], ["g", "7"], ["h", "8"], ]
Tests:
GetFromArray
for (i = 0; i < 10000; i++) { a = arr.find((e) => e.code === "h").status; }
GetFromMap
const newMap = new Map(arrForMap); for (i = 0; i < 10000; i++) { a = newMap.get("h"); }