<div dir="ltr">Just thought I'd follow up now that we've upgraded from GHC 7.10 to GHC 8.0.2 (not 8.2 yet) and are now seeing this code validate the 900-byte sample document in <8us with <220 bytes of allocation. This is awesome. I'm not sure what we did to get 8.0.2 to realise it could make the loop this tight, and I'll look into it some more if I have the time and the inclination.<div><div><br></div><div>There's been various changes since my OP, although nothing fundamental: a bug fix, support for insignificant whitespace, and removal of bounds checks on the arrays. We now pass the test suite from the appendix of <a href="http://seriot.ch/parsing_json.php">http://seriot.ch/parsing_json.php</a> (except for the ones for bare values - we only want arrays or objects).</div><div><br></div><div>Thanks again for everyone's help.<br><div><br></div><div>Cheers,</div><div><br></div><div>David</div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 12 May 2017 at 16:47, Ben Gamari <span dir="ltr"><<a href="mailto:ben@smart-cactus.org" target="_blank">ben@smart-cactus.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Mikolaj Konarski <<a href="mailto:mikolaj@well-typed.com">mikolaj@well-typed.com</a>> writes:<br>
<br>
> Truly impressive. Amazing.<br>
><br>
> I wonder what style of coding of inner loops<br>
> leads to such good results in 8.2. Is it easy to describe?<br>
> Or is the answer "any" or "simplest" or "natural"? If not,<br>
> can it be captured as some recursion combinators perhaps?<br>
><br>
</span>My fairly unhelpful description would be that carefully-written programs<br>
that look like they shouldn't allocate will be helped most. Previously<br>
these program (e.g. probably the one here) would allocate closures due<br>
to GHC's failure to identify some types of join points. In 8.2 our<br>
treatment of join points is more robust and consequently this<br>
unnecessary allocation will be more reliably eliminated.<br>
<br>
Cheers,<br>
<br>
- Ben<br>
<br>
</blockquote></div><br></div>