chore: Optimize HashMap: unconstrained approach #4605
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…of concept
Description
Problem*
Resolves #4584
Summary*
This branch optimizes
HashMap
using an unconstrained approach suggested by @zac-williamson. This PR is here to show the differences of this approach, but the timings and benchmark information are on the PR with the bucketed approach here: #4603Additional Information
The current approach in this PR is not yet abstracted to any key or value type. When this is done it should be noted that this approach also requires
Ord
on the key type.It's also unclear if the unconstrained approach would be as efficient for an API returning an optional value in
get
. I think in theNone
case we would need to iterate through the entire hashmap to assert that they key isn't present to prevent under constraining the result value.Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.