Replacing the old Point pattern synonym over a tuple with:
data Point = Point { x :: !Int, y :: !Int }
we see a healthy speedup for both decoding and encoding.
Storable Vectors
It was easy to write a Storable instance for Point. "Storable Vectors" are very performant, so I've moved back off of Seq and onto storable vectors where ever possible.
Unfolding
To avoid manual consing, I use unfoldr and unfoldrM where ever possible.
Tuples
Turns out tuples are evil!
Replacing the old
Point
pattern synonym over a tuple with:we see a healthy speedup for both decoding and encoding.
Storable
VectorsIt was easy to write a
Storable
instance forPoint
. "Storable Vectors" are very performant, so I've moved back off ofSeq
and onto storable vectors where ever possible.Unfolding
To avoid manual consing, I use
unfoldr
andunfoldrM
where ever possible.