Received: from eggs.gnu.org ([2001:4830:134:3::10]:42398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1etR-0007Ag-70 for qemu-devel@nongnu.org; Wed, 25 Nov 2015 13:34:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1etM-0003Vc-CE for qemu-devel@nongnu.org; Wed, 25 Nov 2015 13:34:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1etM-0003VQ-71 for qemu-devel@nongnu.org; Wed, 25 Nov 2015 13:34:08 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id A34DF8E39B for ; Wed, 25 Nov 2015 18:34:07 +0000 (UTC) From: Markus Armbruster References: <1448300659-23559-1-git-send-email-pbonzini@redhat.com> <87d1uy16hi.fsf@blackfin.pond.sub.org> <5655F929.3010804@redhat.com> Date: Wed, 25 Nov 2015 19:34:01 +0100 In-Reply-To: <5655F929.3010804@redhat.com> (Paolo Bonzini's message of "Wed, 25 Nov 2015 19:08:41 +0100") Message-ID: <87lh9mvsh2.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v2 for-2.5? 0/4] qjson: save a lot of memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org Paolo Bonzini 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.