[Haskell-cafe] Optimizing performance problems with Aeson rendering large Text arrays

Oliver Charles ollie at ocharles.org.uk
Fri Feb 1 21:04:51 CET 2013


On 02/01/2013 01:44 PM, Bas van Dijk wrote:
>
> If I make a special case for text based UUIDs in aeson:
>
> data Value = ... | UUID Text | ...
>
> Data.Aeson.Encode.fromValue (UUID s) = singleton '"' <> fromText s <> 
> singleton '"'
>
> Then encoding time improves by 20%.
>
> So a big part of the time is spent encoding the UUID strings.
>
> Bas
>
This might work, but it doesn't seem to be something I could actually 
distribute, unless I shipped modified Aeson source code... the String 
fromValue pattern seems to do a lot of escaping which won't apply to my 
UUIDs, but I'm not sure what the right solution to that is.

- Ocharles



More information about the Haskell-Cafe mailing list