超高性能C / C ++散列图(表,字典) [英] Super high performance C/C++ hash map (table, dictionary)
问题描述
我需要在高性能哈希映射数据结构中将原始键(int,或许长)映射到结构值。
I need to map primitive keys (int, maybe long) to struct values in a high-performance hash map data structure.
我的程序将有几百个的这些地图,每个地图通常最多有几千个条目。但是,地图将不断刷新或搅动想象一下处理数百万的添加
和删除
消息。
My program will have a few hundred of these maps, and each map will generally have at most a few thousand entries. However, the maps will be "refreshing" or "churning" constantly; imagine processing millions of add
and delete
messages a second.
C或C ++中的哪些库具有适合此用例的数据结构?或者,你怎么建议建立自己的?谢谢!
What libraries in C or C++ have a data structure that fits this use case? Or, how would you recommend building your own? Thanks!
推荐答案
我建议您尝试 Google SparseHash ,看看它是否符合您的需求。它们具有高效的内存效率,并且针对速度进行了优化。
我很久以前就做了一个基准测试,这是在速度方面可用的最好的哈希表实现(但是有缺点)。
I would recommend you to try Google SparseHash and see if it suits your needs. They have a memory efficient implementation as well as one optimized for speed. I did a benchmark a long time ago, it was the best hashtable implementation available in terms of speed (however with drawbacks).
这篇关于超高性能C / C ++散列图(表,字典)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!