Conversation
| unsafeInsertNewLeaf h0 l0 m0 = runST (go h0 l0 0 m0) | ||
| where | ||
| go !_ !l !_ Empty = return l | ||
| go h l@(Leaf _ lx) s t@(Leaf hy ly) |
There was a problem hiding this comment.
I suspect it's not good to have to "case" on the HashMap like this. It might be better to supply the Leaf k x within as an extra argument to unsafeInsertNewLeaf.
There was a problem hiding this comment.
This would probably cause additional allocations though, because the L-Leaf is by default unboxed within the Leaf HashMap node.
| -- See https://github.com/haskell-unordered-containers/unordered-containers/issues/75#issuecomment-1128419337 | ||
| {-# INLINE two #-} | ||
|
|
||
| two' :: Shift -> Hash -> HashMap k v -> Hash -> HashMap k v -> ST s (HashMap k v) |
There was a problem hiding this comment.
We should rather change two to have this type.
There was a problem hiding this comment.
I've refactored two and introduced two' in #521.
| unsafeInsertNewLeaf :: Hash -> HashMap k v -> HashMap k v -> HashMap k v | ||
| unsafeInsertNewLeaf h0 l0 m0 = runST (go h0 l0 0 m0) | ||
| where | ||
| go !_ !l !_ Empty = return l |
There was a problem hiding this comment.
| go !_ !l !_ Empty = return l | |
| go !_h l !_s Empty = return l |
It would probably be better to request that the "caller" ensures that the leaf is in WHNF.
|
#535 contains an even faster version of |
Context: #364
TODO:
Strict.differenceWith