[cfe-dev] RFC: change string hash function in libc++

Craig Silverstein csilvers at google.com
Fri Dec 2 14:42:39 PST 2011


I recently worked with some other folks at Google to replace the
string-hashing function in libstdc++ with Murmurhash
(http://code.google.com/p/smhasher/), a very fast hash function with
excellent hashing properties.

I'd like to propose changing libc++ to also use Murmurhash, or perhaps
Cityhash (http://code.google.com/p/cityhash/), which hasn't been
around as long but seems to perform even better.

Assuming the maintainers are receptive to such a change, we would be
happy to do the work to create a patch to libc++; we just need to know
the proper procedures for doing so.

Also, is there a preference to using Murmurhash or Cityhash?  Both are
excellent hash functions, and are equally portable.  In favor of
Murmurhash: it's been around for longer and is already used in other
STL implementations.  In favor of Cityhash: it performs a bit better
than Murmurhash, on average.

craig



More information about the cfe-dev mailing list