User customizable collection with GAT#33
Open
stevefan1999-personal wants to merge 4 commits into
Open
Conversation
Author
|
I think we could simplify this so I removed fnv as well. This means hashbrown for no_std, and std hash for normal circumstances. Almost zero change in code surface |
Author
|
The reason I also added heapless because I want to run it on the context of extreme environment like in a smart contract kernel where we can't afford to have dynamic memory allocation, I also want to experiment this on GPU using rust-cuda as well, and memory allocation is not recommended on GPU programming. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I needed this because I'm writing a C compiler and I want to use a new approach to the type checking & semantic analysis part of it. Basically, if I can encode the types as constraints, then we can use something like prolog to find violation and even things like strict aliasing rather than pumping out a manual check with memory boundaries every time.
However that compiler is written in no_std first approach and so I cannot guarantee that std hash collection is always there. So instead I think we should inverse the control
Interesting findings: I added a benchmark and noticed that std collection hash map/hash set is significantly slower than hashbrown hash map/hash set, and hashbrown is also significantly slower than fnv when the collection gets larger. That's also a reason we want to introduce user customizable collection because the default hash map performance sucks