-
Notifications
You must be signed in to change notification settings - Fork 15
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
Replace hash maps with slot maps in storage. #16
Comments
It may be difficult to use both kinds of collections (slot maps and hash maps) together, because abstracting over iterators is not currently possible in Rust. If traits are used to abstract storage, then it is no longer possible to expose iterators without resorting to trait objects, boxing, and dynamic dispatch. I made some good progress on this, but I'd really like to avoid boxing iterators, as they are very commonly used and could present a real performance penalty (no benchmarks though, so I can't be too sure). This also affects issue #17 for which I have been using the same branch. It's probably worth mentioning that associated type constructors could really help with this, as they would allow storage to be abstracted behind a trait with iterators and all. |
There is currently a working example of this on the storage branch. Unfortunately, it requires that storage iterators are boxed, so direct iteration over a Abstracting containers is used here to allow |
This work has landed in ba64094. This better abstracts storage and introduces slot maps. There are two points to keep in mind though:
I'll close this for now and may open additional issues for followup work. |
Consider replacing the use of
HashMap
with a slot map inStorage
. This could improve performance (benchmarks?). This crate looks promising.However, edges currently use keys built from their corresponding vertex keys, which is incompatible with slot maps (because it requires being able to specify the key). Examine this pattern to see if it can be removed or modified or if continuing to use
HashMap
for edges is a better approach.The text was updated successfully, but these errors were encountered: