Run alter in one pass#471
Run alter in one pass#471oberblastmeister wants to merge 7 commits intohaskell-unordered-containers:masterfrom
Conversation
sjakobi
left a comment
There was a problem hiding this comment.
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.
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.
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 |
|
Thanks for all the work you did on this, @oberblastmeister! :) I hope you don't mind if I try to finish it up in #548! |
Resolves #404