关于 Swiss Table (absl::flat_hash_map)
shines77 opened this issue · comments
最近测试我改进的swiss table- emilib2/3. 我的实现查询性能比官方慢20%,插入则快20%,一直分析对比查找哪里查询慢(我在乎查询性能),一个区别在于我使用线性探测,而swiss table使用二次探测,还有你之前说的swiss做了随机内存地址优化,这些难道是主要原因?
-------------------------------- function benchmark -----------------------------------------------
erase_50
85 emilib3 100.0%
95 emilib2 89.9%
97 absl_flat 87.5%
erase_reinsert
62 absl_flat 100.0%
88 emilib3 70.1%
100 emilib2 62.2%
find_erase_50
79 absl_flat 100.0%
94 emilib3 84.1%
99 emilib2 80.3%
find_hit_0
85 absl_flat 100.0%
92 emilib2 92.8%
98 emilib3 87.2%
find_hit_100
83 absl_flat 100.0%
94 emilib2 88.5%
97 emilib3 85.7%
find_hit_50
85 absl_flat 100.0%
93 emilib2 91.3%
97 emilib3 87.2%
find_hit_50_erase
91 absl_flat 100.0%
94 emilib3 97.2%
98 emilib2 92.9%
hash_iter
44 emilib2 100.0%
44 emilib3 99.0%
100 absl_flat 44.3%
insert_erase
71 emilib3 100.0%
86 absl_flat 82.9%
97 emilib2 73.0%
insert_find_erase
76 emilib3 100.0%
93 emilib2 81.6%
96 absl_flat 79.0%
insert_hit
93 emilib3 100.0%
96 emilib2 96.4%
97 absl_flat 96.0%
insert_l1_cache
33 emilib2 100.0%
35 emilib3 94.5%
100 absl_flat 33.5%
insert_l3_cache
86 emilib3 100.0%
89 emilib2 97.2%
97 absl_flat 89.0%
insert_no_reserve
94 emilib3 100.0%
95 absl_flat 99.7%
96 emilib2 97.9%
multi_small_ife
84 emilib3 100.0%
93 emilib2 90.8%
95 absl_flat 88.5%
======== hash top1 top2 top3 =======================
absl_flat 2.0 4.0 22
emilib2 0.0 22.0 6
emilib3 26.0 2.0 0
======== hash score weigh ==========================
absl_flat 85 92.4%
emilib2 88 95.0%
emilib3 93 100.0%
--------------------------------------------------------------------
Originally posted by @ktprime in #1 (comment)