Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std::unordered_map is better than std::map #16

Open
qiweiye opened this issue Oct 30, 2018 · 2 comments
Open

std::unordered_map is better than std::map #16

qiweiye opened this issue Oct 30, 2018 · 2 comments

Comments

@qiweiye
Copy link

qiweiye commented Oct 30, 2018

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

@shalithasuranga
Copy link
Contributor

Yah I also think unordered map is better since we just need to access an element. Can you give a pull request

@janvichoudhary08
Copy link

hey please assign me this issue as a part of hacktoberfest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants