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

Extract index from the high hash bits instead of the low bits. #71

Closed
wants to merge 3 commits into from

Commits on Apr 25, 2019

  1. Extract index from the high hash bits instead of the low bits.

    Some Hashers, and FxHasher in particular, mix the low bits poorly; so only use the high bits for both hashes.
    
    Instead of introducing bucket_shift next to bucket_mask in the top-level struct, derive them both from capacity_log2. This avoids exacerbating struct size in rust-lang#69.
    
    This change is also a prerequisite for rayon-based parallel collect, which requires that the high bits of the index are always in the same place regardless of table size.
    
     name                     old ns/iter  new ns/iter  diff ns/iter   diff %  speedup
     find_existing            0            0                       0     NaN%    x NaN
     find_existing_high_bits  84,320       3,442             -80,878  -95.92%  x 24.50
     find_nonexisting         0            0                       0     NaN%    x NaN
     get_remove_insert        25           29                      4   16.00%   x 0.86
     grow_by_insertion        205          209                     4    1.95%   x 0.98
     grow_by_insertion_kb     290          180                  -110  -37.93%   x 1.61
     hashmap_as_queue         25           26                      1    4.00%   x 0.96
     insert_8_char_string     18,038       17,491               -547   -3.03%   x 1.03
     new_drop                 0            0                       0     NaN%    x NaN
     new_insert_drop          45           50                      5   11.11%   x 0.90
    edre committed Apr 25, 2019
    Configuration menu
    Copy the full SHA
    89bdf54 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1f99d31 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    cfa7cc1 View commit details
    Browse the repository at this point in the history