rust-lang / rust-lang/hashbrown
Extend HashTable's bucket API to support insertion ?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3k
- Forks
- 358
- Avg merge
- 11h 57m
- Merged PRs (30d)
- 2
Description
When one wishes to "get or insert" from/into a HashTable that is behind a RwLock, one typically first attempts to "get" with only a read lock (via the .find API), and only if that fails fallback to a "get or insert" with a write lock (via the .entry API).
However, the .entry call repeats the probing that was undertaken during the .find call: this is necessary because the table could have been modified between release of the read lock and acquisition of the write lock.
But in some cases, one might be able to determine whether the table was modified in the interim and thus avoid such duplicate probing. For example, if the table is append-only and its length has not changed.
The new bucket API almost exposes such an ability, but not quite. Is there any interest it being extended to support this use case, or is this perhaps too niche for hashbrown?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the HashTable bucket API and the existing .find and .entry paths described in the issue. Determine what API extension could safely avoid duplicate probing when an append-only table is unchanged, and define completion around an agreed interface and coverage of the concurrent-use case; no files or tests are named.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100