-
-
Notifications
You must be signed in to change notification settings - Fork 257
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
Remove HashMap from derive/generate #442
Conversation
There is a lot of value in outputs produced by compilers being reproducible. Rust makes it somewhat hard to get it right, but most of the time rustc’s outputs are also reproducible. This allows us to enjoy all the benefits as other more primitive toolchains. Most of the time. Pest was, sadly, one of those examples where reproducibility was not a concern and HashMap was used to implement some of the code generation portions. Replacing this `HashMap` with a `Vec` and a `O(nm)` loop is the easy solution. With the values that `n` and `m` get substituted with in practice, however, this loop should still be approximately as good as the previous `HashMap` implementation.
Another option would be indexmap, which both uses hashes and guarantees a stable (insertion) ordering. It's basically this approach plus a hash-based lookup cache to make lookups amortized constant time. But that said, this is a fine fix and a fix you have is always better than a theoretical one, which can be applied later. bors: r+ cc @dragostis a release for this fix ASAP would be nice. |
442: Remove HashMap from derive/generate r=CAD97 a=nagisa There is a lot of value in outputs produced by compilers being reproducible. Rust makes it somewhat hard to get it right, but most of the time rustc’s outputs are also reproducible. This allows us to enjoy all the benefits as other more primitive toolchains. Most of the time. Pest was, sadly, one of those examples where reproducibility was not a concern and HashMap was used to implement some of the code generation portions. Replacing this `HashMap` with a `Vec` and a `O(nm)` loop is the easy solution. With the values that `n` and `m` get substituted with in practice, however, this loop should still be approximately as good as the previous `HashMap` implementation. Co-authored-by: Simonas Kazlauskas <git@kazlauskas.me>
Build failed |
Gah, looks like #443 is going to block the build. I need @dragostis to fix this one 😓 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The |
bors r+ |
Build succeeded |
Please release a version of |
There is a lot of value in outputs produced by compilers being
reproducible. Rust makes it somewhat hard to get it right, but most of
the time rustc’s outputs are also reproducible. This allows us to enjoy
all the benefits as other more primitive toolchains. Most of the time.
Pest was, sadly, one of those examples where reproducibility was not a
concern and HashMap was used to implement some of the code generation
portions. Replacing this
HashMap
with aVec
and aO(nm)
loop isthe easy solution. With the values that
n
andm
get substituted within practice, however, this loop should still be approximately as good as
the previous
HashMap
implementation.