[Haskell-cafe] Fast JSON validation - reducing allocations

David Turner dct25-561bs at mythic-beasts.com
Fri May 12 08:10:50 UTC 2017


Morning all,

On 11 May 2017 at 20:32, Ben Gamari <ben at smart-cactus.org> wrote:

>
> Something that I should have mentioned earlier is that STG has the nice
> property that all allocation is syntactically obvious: allocated
> closures manifest as `let`s. This makes it fairly easy to pick out
> possible allocation sites, even in large dumps.
>


Ah, that's very useful to know!

Armed with that knowledge, I came to the conclusion that the allocation was
for the sharing of the `nextState` variable. Inlining it brings it down to
20us and 22kB per iteration.

https://github.com/DaveCTurner/json-validator/commit/ec994ec9226ca7bc2e76f19bef98f42e0b233524

Getting closer, but it looks like waiting for 8.2 is a better answer.
Looking forward to it!

Cheers,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170512/1e039627/attachment.html>


More information about the Haskell-Cafe mailing list