rust-lang / rust-lang/hashbrown

Improving performance by updating Abseil design

Open
#635 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3k
Forks
358
Avg merge
11h 57m
Merged PRs (30d)
2

Description

I heard that HashMap is based on Google original design for absl::flat_hash_map.

And noticed there was some room for improvement in Abseil implementation, so I rolled out my own (C++) versions with and without tombstones recently, including comparative benchmarks (for llvm, gcc, msvc).

I think Hashbrown/the Rust std lib could also benefit from these improvements (and additional benchmark scenarios)
by updating few things in its current design (based on the model of indivi::flat_wmap). Mainly, it would imply using 8-bits hash fragments instead of 7 to reduce fast performance divergence on high load scenarios (in particular lookup-miss, see graphs curves).

For more details (benchmarks, documentation, impl specifics), please check this thread (in particular the discussion with u/matthieum):
https://www.reddit.com/r/rust/comments/1mloi7k/rust_hashmap_implementationperformance/

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the current HashMap implementation alongside the linked C++ benchmarks and Reddit discussion. Compare the proposed 7-bit versus 8-bit hash fragments, tombstone variants, and additional benchmark scenarios. Done requires an agreed design, an implementation, and comparative benchmark results.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.