Super high performance C/C++ hash map (table, dictionary)(超高性能C/C++哈希映射(表、字典))
问题描述
我需要将原始键(int,可能是 long)映射到高性能哈希映射数据结构中的结构值.
I need to map primitive keys (int, maybe long) to struct values in a high-performance hash map data structure.
我的程序会有几百张这样的地图,而每张地图一般最多只有几千个条目.但是,地图会不断刷新"或搅动";想象一下,每秒处理数百万条 add
和 delete
消息.
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(或 C11 版本 Google SparseHash-c11)并查看它是否适合您的需求.它们具有内存高效的实现方式以及针对速度进行了优化的实现方式.我很久以前做过一个基准测试,它是速度方面最好的哈希表实现(但也有缺点).
I would recommend you to try Google SparseHash (or the C11 version Google SparseHash-c11) 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++哈希映射(表、字典)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:超高性能C/C++哈希映射(表、字典)
基础教程推荐
- C++ 程序在执行 std::string 分配时总是崩溃 2022-01-01
- 您如何将 CreateThread 用于属于类成员的函数? 2021-01-01
- 运算符重载的基本规则和习语是什么? 2022-10-31
- 什么是T&&(双与号)在 C++11 中是什么意思? 2022-11-04
- 设计字符串本地化的最佳方法 2022-01-01
- 调用std::Package_TASK::Get_Future()时可能出现争用情况 2022-12-17
- C++,'if' 表达式中的变量声明 2021-01-01
- C++ 标准:取消引用 NULL 指针以获取引用? 2021-01-01
- 如何定义双括号/双迭代器运算符,类似于向量的向量? 2022-01-01
- 如何在 C++ 中处理或避免堆栈溢出 2022-01-01