Open sjakobi opened 2 years ago
A little bit, probably. Have you played with applying manual worker-wrapper to the function argument of alter
?
alter# :: _ => ((# (##) | v #) -> (# (##) | v #)) -> k -> HashMap k v -> HashMap k v
alter f = alter# f where
f' (# _ | #) = twiddle (f Nothing)
f' (# | v #) = twiddle (f (Just v))
twiddle Nothing = (# (##) | #)
twiddle (Just v) = (# | v #)
The hope is that f
inlines into the wrapper and the Maybe
s are never realized. Whether this is faster... I'm not so sure. I've had pretty mediocre results from my limited experiments with unboxed sums, but that was a few years ago.
In the context of #404 I've had a brief look at
update
. My impression was that it might benefit from inliningalter
. It would be good to take a closer look once #404 is done.