std::unordered_map is better than std::map
- Dominant language
- C++
- Stars
- 273
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Description
Since the key logic is that given the plain string, find the respond unicode string, the unordered_map is better.
I did some simple test case for both, below are the test result:
std::unordered_map version:
Elapsed time: 0.000145379 s
Elapsed time: 0.000127852 s
Elapsed time: 0.00012735 s
Elapsed time: 0.00012398 s
Elapsed time: 0.000123349 s
Elapsed time: 0.000126856 s
std::map version:
Elapsed time: 0.000279197 s
Elapsed time: 0.000269347 s
Elapsed time: 0.000259659 s
Elapsed time: 0.000255836 s
Elapsed time: 0.000258944 s
Elapsed time: 0.000256731 s
Contributor guide
No contributing guide indexed for this repository
Research direction
No source file or test is named in the issue. Start by locating the string-to-Unicode mapping implementation and checking whether it relies on std::map ordering; compare the existing behavior with the reported unordered_map benchmark. Done means preserving the lookup results while confirming the change with the project's available tests or benchmark.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100