You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
foldrBits prefix f z bitmap = go (revNat bitmap) z
where go 0 acc = acc
go bm acc = go (bm `xor` bitmask) ((f $! (prefix+(WORD_SIZE_IN_BITS-1)-bi)) acc)
where!bitmask = lowestBitMask bm
!bi = indexOfTheOnlyBit bitmask
This is unusual because go traverses the full word, building up thunks, before returning a result.
I would expect a foldr to be defined as
go 0= z
go bm = f x (go bm')
where x =...
bm' =...
I don't think this has an effect on correctness, but it might have an effect on performance.
The implementation was introduced in e076b33, which says
Foldr implementations bit-reverse the word and then iterate from the LSB
to MSB using accumulator. That is faster then either not using
accumulator or iterating from MSB to LSB.
Which seems a bit odd and worth rechecking in my opinion. Thoughts?
The text was updated successfully, but these errors were encountered:
foldrBits
is defined inData.IntSet.Internal
ascontainers/containers/src/Data/IntSet/Internal.hs
Lines 1649 to 1653 in f61b0c9
This is unusual because
go
traverses the full word, building up thunks, before returning a result.I would expect a
foldr
to be defined asI don't think this has an effect on correctness, but it might have an effect on performance.
The implementation was introduced in e076b33, which says
Which seems a bit odd and worth rechecking in my opinion. Thoughts?
The text was updated successfully, but these errors were encountered: