Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
int vs str map key perf set and get
(version: 1)
Comparing performance of:
int vs str
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var intMap = new Map(); var stringMap = new Map();
Tests:
int
intMap.set(1, "aaa"); intMap.set(2, "bbb"); intMap.set(3, "ccc"); var a1 = intMap.get(1); var b2 = intMap.get(2); var c3 = intMap.get(3);
str
stringMap.set("1", "aaa"); stringMap.set("2", "bbb"); stringMap.set("3", "ccc"); var a = stringMap.get("a"); var b = stringMap.get("b"); var c = stringMap.get("c");
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
int
str
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:137.0) Gecko/20100101 Firefox/137.0
Browser/OS:
Firefox 137 on Mac OS X 10.15
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
int
23299036.0 Ops/sec
str
16225273.0 Ops/sec
Related benchmarks:
Foreach vs Spread
Map vs Object (R+W)
Map vs Object Improved
Map vs Object: Full benchmark
Map string versus number keys
Map string versus number keys big sets
Map.has vs Object hasOwnProperty
Map.has vs Object hasOwnProperty vs direct check v2
int vs str map key perf set and get 1
Comments
Confirm delete:
Do you really want to delete benchmark?