99x / emojicpp

Emoji :smile: for c++ developers :+1:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

std::unordered_map is better than std::map

qiweiye opened this issue · comments

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

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

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