haskell-hvr / cassava

A CSV parsing and encoding library optimized for ease of use and high performance
http://hackage.haskell.org/package/cassava
BSD 3-Clause "New" or "Revised" License
222 stars 107 forks source link

Avoid intermediate bytestring construction when encoding #8

Open meiersi opened 12 years ago

meiersi commented 12 years ago

Currently, lot's of intermediate bytestrings are constructed during encoding. This is unnecessary and could be avoided by adding a toFieldBuilder method to the ToRecord typeclass. I expect at least a factor two speedup in encoding from this change.

tibbe commented 12 years ago

I've thought about doing that and might do it eventually. Right my whole encoding implementation is very naive (have a look at the encode function) so I expect there's even more easily wins to be had. Since my implementation is already faster than the Python csv library (which is written in C) I didn't bother so far.