-
Notifications
You must be signed in to change notification settings - Fork 100
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
Run alter in one pass #471
base: master
Are you sure you want to change the base?
Run alter in one pass #471
Conversation
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.
Thanks! I have only minor comments! :)
Please update Strict.alter
and Strict.update
similarly. I'm curious what impact this will have on the benchmarks.
Just v' -> Collision hy $ A.snoc ls $ L k v' | ||
| otherwise = case f Nothing of | ||
Nothing -> t | ||
Just v' -> runST $ two s h k v' hy t |
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.
If we use two
for Collision
nodes, we'll need to update its documentation. Could you do that?
#447 is related.
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.
What should I put in the documentation? I think the function may also need a more descriptive name, like bitmapIndexedFromTwo
or something.
Co-authored-by: Simon Jakobi <simon.jakobi@gmail.com>
I bet we could implement |
Probably. My inclination is not to rely on GHC optimizations more than necessary though. Also, wouldn't this increase the size of the unfolding and thereby make it less likely that |
I think these are very simple optimizations, beta reduction and case simplification, which are performed by the ghc simplifier, and I am pretty sure these are very likely to fire. We also rely on these sorts of optimizations throughout the library anyways. It doesn't matter that much though, but would reduce a lot of code duplication, as Why would this increase the size of the unfolding? |
Sorry for the late response!
I think this means that GHC will need to spend more cycles on optimizing usage of Feel free to give it a try in a follow-up PR though. I'm curious what effects this will have on the Core for
My bad. Briefly, I had thought that the unfolding for |
I can't really tell if the benchmarks get faster or not, which is a bit weird. |
I wonder if the old |
Resolves #404