Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ahash as an alternative hash function #33

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add ahash as an alternative hash function #33

wants to merge 1 commit into from

Conversation

mcy
Copy link
Collaborator

@mcy mcy commented May 16, 2022

Even though my benchmarks for Rust show that ahash destroys absl hash, this port apparently performs up to 4x worse, so something is messed up in the codegen somewhere; I need to debug this.

To give an idea of what the Rust benchmarks look like:

absl/i64                time:   [3.0473 ms 3.0492 ms 3.0520 ms]
ahash/i64               time:   [1.5593 ms 1.5654 ms 1.5720 ms]
absl/small &[u8]        time:   [6.0225 ms 6.0371 ms 6.0561 ms]  
ahash/small &[u8]       time:   [3.5620 ms 3.5657 ms 3.5696 ms]

Meanwhile, the C++ benchmarks are terrible:

CC=clang bazel run :cwisstable_benchmark -c opt
----------------------------------------------------------------------------------------------
Benchmark                                    Time             CPU   Iterations UserCounters...
----------------------------------------------------------------------------------------------
BM_CacheInSteadyState/448                14795 ns        14795 ns        42799 items_per_second=67.5905k/s load_factor=0.44
BM_CacheInSteadyState/493                14791 ns        14790 ns        47326 items_per_second=67.6126k/s load_factor=0.48
BM_CacheInSteadyState/538                14816 ns        14815 ns        47223 items_per_second=67.4983k/s load_factor=0.53
BM_CacheInSteadyState/583                14810 ns        14809 ns        47305 items_per_second=67.5271k/s load_factor=0.57
BM_CacheInSteadyState/628                14844 ns        14843 ns        47164 items_per_second=67.3697k/s load_factor=0.61
BM_CacheInSteadyState/672                14837 ns        14837 ns        47116 items_per_second=67.3997k/s load_factor=0.66
BM_CacheInSteadyState/717                14874 ns        14873 ns        47026 items_per_second=67.2371k/s load_factor=0.70
BM_CacheInSteadyState/762                14929 ns        14928 ns        46896 items_per_second=66.9872k/s load_factor=0.74
BM_CacheInSteadyState/807                14793 ns        14792 ns        47508 items_per_second=67.6026k/s load_factor=0.39
BM_CacheInSteadyState/852                14832 ns        14832 ns        47399 items_per_second=67.4224k/s load_factor=0.42
BM_EndComparison/400                      1391 ns         1391 ns       505350
BM_CopyCtor/128                           1480 ns         1480 ns       467681
BM_CopyCtor/512                           6062 ns         6062 ns       117797
BM_CopyCtor/4096                         55412 ns        55407 ns        12656
BM_RangeCtor/128                          7269 ns         7269 ns        96470
BM_RangeCtor/512                         29014 ns        29012 ns        24230
BM_RangeCtor/4096                       235547 ns       235536 ns         2964
BM_RangeCtor/32768                     2022793 ns      2022756 ns          346
BM_RangeCtor/65536                     4268254 ns      4268095 ns          164
BM_NoOpReserveIntTable                   0.234 ns        0.234 ns   1000000000
BM_NoOpReserveStringTable                0.235 ns        0.235 ns   1000000000
BM_ReserveIntTable/128                     213 ns          214 ns      3291830
BM_ReserveIntTable/512                     213 ns          214 ns      3250297
BM_ReserveIntTable/4096                    264 ns          265 ns      2637759
BM_ReserveStringTable/128                  297 ns          298 ns      2349449
BM_ReserveStringTable/512                  529 ns          530 ns      1314091
BM_ReserveStringTable/4096                2770 ns         2771 ns       253236
BM_Group_Match                           0.499 ns        0.499 ns   1000000000
BM_Group_MatchEmpty                      0.471 ns        0.471 ns   1000000000
BM_Group_MatchEmptyOrDeleted             0.469 ns        0.469 ns   1000000000
BM_Group_CountLeadingEmptyOrDeleted      0.468 ns        0.467 ns   1000000000
BM_Group_MatchFirstEmptyOrDeleted        0.452 ns        0.452 ns   1000000000
BM_DropDeletes                           32202 ns        32197 ns        22220

CC=clang bazel run :cwisstable_benchmark_no_aes -c opt
----------------------------------------------------------------------------------------------
Benchmark                                    Time             CPU   Iterations UserCounters...
----------------------------------------------------------------------------------------------
BM_CacheInSteadyState/448                 9684 ns         9683 ns        58926 items_per_second=103.269k/s load_factor=0.44
BM_CacheInSteadyState/493                 9693 ns         9693 ns        71853 items_per_second=103.167k/s load_factor=0.48
BM_CacheInSteadyState/538                 9708 ns         9708 ns        72320 items_per_second=103.01k/s load_factor=0.53
BM_CacheInSteadyState/583                 9714 ns         9713 ns        72044 items_per_second=102.953k/s load_factor=0.57
BM_CacheInSteadyState/628                 9721 ns         9720 ns        72163 items_per_second=102.876k/s load_factor=0.61
BM_CacheInSteadyState/672                 9750 ns         9750 ns        71999 items_per_second=102.569k/s load_factor=0.66
BM_CacheInSteadyState/717                 9760 ns         9759 ns        71722 items_per_second=102.466k/s load_factor=0.70
BM_CacheInSteadyState/762                 9837 ns         9837 ns        71413 items_per_second=101.66k/s load_factor=0.74
BM_CacheInSteadyState/807                 9696 ns         9696 ns        72910 items_per_second=103.139k/s load_factor=0.39
BM_CacheInSteadyState/852                 9699 ns         9698 ns        72519 items_per_second=103.114k/s load_factor=0.42
BM_EndComparison/400                      1322 ns         1322 ns       511558
BM_CopyCtor/128                           1093 ns         1093 ns       648516
BM_CopyCtor/512                           4528 ns         4528 ns       159269
BM_CopyCtor/4096                         45876 ns        45872 ns        15028
BM_RangeCtor/128                           868 ns          868 ns       813842
BM_RangeCtor/512                          3216 ns         3215 ns       218478
BM_RangeCtor/4096                        25949 ns        25948 ns        27169
BM_RangeCtor/32768                      242875 ns       242838 ns         2823
BM_RangeCtor/65536                      520697 ns       520687 ns         1335
BM_NoOpReserveIntTable                   0.234 ns        0.234 ns   1000000000
BM_NoOpReserveStringTable                0.233 ns        0.233 ns   1000000000
BM_ReserveIntTable/128                     206 ns          208 ns      3334134
BM_ReserveIntTable/512                     209 ns          211 ns      3322353
BM_ReserveIntTable/4096                    269 ns          270 ns      2628556
BM_ReserveStringTable/128                  298 ns          299 ns      2340071
BM_ReserveStringTable/512                  530 ns          531 ns      1323468
BM_ReserveStringTable/4096                2766 ns         2768 ns       253804
BM_Group_Match                           0.474 ns        0.474 ns   1000000000
BM_Group_MatchEmpty                      0.472 ns        0.472 ns   1000000000
BM_Group_MatchEmptyOrDeleted             0.472 ns        0.472 ns   1000000000
BM_Group_CountLeadingEmptyOrDeleted      0.469 ns        0.469 ns   1000000000
BM_Group_MatchFirstEmptyOrDeleted        0.456 ns        0.456 ns   1000000000
BM_DropDeletes                           20700 ns        20704 ns        33807

Signed-off-by: Miguel Young de la Sota <mcyoung@google.com>
@mcy
Copy link
Collaborator Author

mcy commented May 16, 2022

Rust benchmarks: rustbench.tar.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant