Paolo Bonzini <pbonz...@redhat.com> writes: > On 25/11/2015 15:47, Markus Armbruster wrote: >> > This patch from 2011 (!) saves about 96% of the allocation cost (down >> > from 500 MiB to 20 MiB) for check-qjson. >> >> Looks good to me apart from the incomplete transition to recursive >> descent in PATCH 2. > > I do not understand whether that is a problem. Is the remark from the > commit message incorrect ("Saving the parser context is mostly > unnecessary; we can replace it with peeking at the next token, or remove > it altogether when the restore only happens on errors. The token list > is destroyed anyway on errors.")?
The token sequence { 1 [ 2 ] } gets parsed as [ 2 ]. See my reply to PATCH 2 for a more detailed explanation. I didn't bother to construct an example where QMP executes the incorrect result, and I'm not sure it's possible. Regardless, I'm fixing it, by simplifying the parser some more.