-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
To make consecutive (unboxed) snoc and (future) unsnoc operations faster, we might consider more compact representations of the tails. In particular, we can "chunk" them if we like. Something like this:
data ListTwos a
= Snoc2 !(ListTwos a) a a
| Nil2
data Tail a = Tail
{ pairs :: !(ListTwos a)
, maybeLast :: a }The maybeLast component of the Tail is the last element if the Vector (and therefore the Tail) has an odd number of elements, and is undefined if the Vector has an even number of elements.
Of course, we could choose any small power of 2 for the chunk size, and some experimentation will be required to pick the right one.
Metadata
Metadata
Assignees
Labels
No labels