fosskers / vectortiles

A native Haskell codec for Mapbox Vector Tiles.
BSD 3-Clause "New" or "Revised" License
20 stars 10 forks source link

Further improve performance #17

Closed fosskers closed 6 years ago

fosskers commented 6 years ago

Tuples

Turns out tuples are evil!

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.