[Haskell-cafe] Is it possible to have constant-space JSON decoding?

Iustin Pop iustin at google.com
Tue Dec 4 15:58:02 CET 2012


On Tue, Dec 04, 2012 at 09:47:52AM -0500, Clark Gaebel wrote:
> Aeson is used for the very common usecase of short messages that need to be
> parsed as quickly as possible into a static structure. A lot of things are
> sacrificed to make this work, such as incremental parsing and good error
> messages. It works great for web APIs like twitter's.

I see, good to know.

> I didn't even know people used JSON to store millions of integers. It
> sounds like fun.

Actually, that's not the actual use case :), this was just an example to
show memory use with trivial data structures (where strictness/lazyness
is easier to reason about).

In my case, I have reasonably-sized message of complex objects, which
results in the same memory profile: cost of input message (as
String/ByteString) plus cost of the converted objects. What bothers me
is that I don't seem to be able to at least remove the cost of the input
data after parsing, due to non-strict types I convert to.

thanks,
iustin



More information about the Haskell-Cafe mailing list