What's the best hashing algorithm to use on a stl string when using hash_map?

前端 未结 11 2323
生来不讨喜
生来不讨喜 2020-12-04 10:41

I\'ve found the standard hashing function on VS2005 is painfully slow when trying to achieve high performance look ups. What are some good examples of fast and efficient has

11条回答
  •  孤城傲影
    2020-12-04 11:35

    If your strings are on average longer than a single cache line, but their length+prefix are reasonably unique, consider hasing just the length+first 8/16 characters. (The length is contained in the std::string object itself and therefore cheap to read)

提交回复
热议问题