How can I increase the performance in a map lookup with key type std::string?

后端 未结 14 975
天涯浪人
天涯浪人 2021-02-05 23:25

I\'m using a std::map (VC++ implementation) and it\'s a little slow for lookups via the map\'s find method.

The key type is std::string.

14条回答
  •  后悔当初
    2021-02-05 23:50

    std::map's comparator isn't std::equal_to it's std::less, I'm not sure what the best way to short circuit a < compare so that it would be faster than the built in one.

    If there are always < 15 elems, perhaps you could use a key besides std::string?

提交回复
热议问题