Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Map.has vs Map.get
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:134.0) Gecko/20100101 Firefox/134.0
Browser:
Firefox 134
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
has
9625.6 Ops/sec
get
10820.0 Ops/sec
HTML Preparation code:
<div id=''></div>
Script Preparation code:
const map = new Map(); map.set("foo", 1); const map1 = new Map(); map1.set("foo", 1); let count = 10000;
Tests:
has
const map = new Map(); map.set("foo", 1); for(let i = 0; i < 10000; i ++){ if(map.has("foo")){ map.set("foo", map.get("foo") + 1); } }
get
const map1 = new Map(); map1.set("foo", 1); for(let i = 0; i < 10000; i ++){ const num = map1.get("foo"); if(num){ map1.set("foo", num + 1); } }