Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Map perf has vs get test
(version: 1)
Comparing performance of:
Check: has vs Check: get vs Check: get !!
Created:
3 days ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const d1 = new Map(); for (let i = 0; i < 10000; i++) { d1.set(i, i + 1); // to remove 0 for get } const d2 = new Map(); for (let i = 0; i < 10000; i++) { d2.set(i, i + 1); // to remove 0 for get } const d3 = new Map(); for (let i = 0; i < 10000; i++) { d3.set(i, i + 1); // to remove 0 for get }
Tests:
Check: has
let v1 = 0; for (let i1 = 0; i1 < 10000; i1++) { if (d1.has(i1)) { v1++; } }
Check: get
let v2 = 0; for (let i2 = 0; i2 < 10000; i2++) { if (d2.get(i2)) { v2++; } }
Check: get !!
let v3 = 0; for (let i3 = 0; i3 < 10000; i3++) { if (!!d3.get(i3)) { v3++; } }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Check: has
Check: get
Check: get !!
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
3 days ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:152.0) Gecko/20100101 Firefox/152.0
Browser/OS:
Firefox 152 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Check: has
10492.6 Ops/sec
Check: get
9218.0 Ops/sec
Check: get !!
9340.6 Ops/sec
Comments
Confirm delete:
Do you really want to delete benchmark?