Hash table collision resolution
最近需要一个高性能的hash实现,对比了很多实现hash表的源代码,主要区别在于冲突检测的实现方式。
关于冲突检测的两种方式的对比(chaining and open addressing):
http://www.absoluteastronomy.com/enc1/hash_table
Google有一个高效的实现Open addressing hash 的开源项目
http://goog-sparsehash.sourceforge.net/
Open addressing的性能可能会更好些,但是前提是需要一个非常好的hash生成算法。如果使用Chaining方式,加上一个非常高效的memory pool管理,减少cache失效时间,平均性能应该和Open addressing差不多。
Related posts: