Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Member Access Object vs Map(string key) vs Map(object key)
Member Access Object vs Map(string key) vs Map(object key)
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/142.0.0.0 Safari/537.36
Browser:
Chrome 142
Operating system:
Windows
Device Platform:
Desktop
Date tested:
5 months ago
Test name
Executions per second
Object
15037888.0 Ops/sec
Map(string key)
13392219.0 Ops/sec
Map(object key)
13427578.0 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const N = 1<<16 let tmp; const getInt = (()=>{r=Math.random;f=Math.floor;return (a=0,b=0x100000000)=>f(r()*(b-a))+a})(); const getStr = ((n=8,a=0x20,b=0xD7B0)=>String.fromCharCode(...Array(n).fill(0,0,n).map(()=>getInt(a,b)))) const objS = {}; const mapS = new Map(); const mapO = new Map(); const strKeys = new Array(N); const objKeys = new Array(N); for(i=0;i<N;i++) { const strKey = getStr(); const objKey = { key : strKey }; const value = { num : getInt(), str : getStr(0x100)}; objS[strKey] = value; mapS.set(strKey, value); mapO.set(objKey, value); strKeys[i] = strKey; objKeys[i] = objKey; }
Tests:
Object
for(i=0;i<0x400;i++) tmp = objS[strKeys[getInt(0,N)]]
Map(string key)
for(i=0;i<0x400;i++) tmp = mapS.get(strKeys[getInt(0,N)])
Map(object key)
for(i=0;i<0x400;i++) tmp = mapO.get(objKeys[getInt(0,N)])