From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZN5tM-0004iE-0x for qemu-devel@nongnu.org; Wed, 05 Aug 2015 17:06:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZN5tH-0001gd-NM for qemu-devel@nongnu.org; Wed, 05 Aug 2015 17:06:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48855) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZN5tH-0001gW-Ex for qemu-devel@nongnu.org; Wed, 05 Aug 2015 17:06:23 -0400 References: <1438703896-12553-1-git-send-email-armbru@redhat.com> <1438703896-12553-33-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55C27AC8.8060906@redhat.com> Date: Wed, 5 Aug 2015 15:06:16 -0600 MIME-Version: 1.0 In-Reply-To: <1438703896-12553-33-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CtsnxsIpEhx6s5OFK8lLi285xB2eJjuJK" Subject: Re: [Qemu-devel] [PATCH RFC v3 32/32] qapi-introspect: Hide type names List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: kwolf@redhat.com, berto@igalia.com, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --CtsnxsIpEhx6s5OFK8lLi285xB2eJjuJK Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/04/2015 09:58 AM, Markus Armbruster wrote: > To eliminate the temptation for clients to look up types by name > (which are not ABI), replace all type names by meaningless strings. >=20 > Reduces output of query-schema by 13 out of 85KiB. I'm starting to be more in favor of this patch, both for ABI reasons and for size shavings. It definitely looks better than in v2, where munged names are just an arbitrary number, and where builtins are not munged. >=20 > TODO Either generate comments with the true type names, or provide an > option to generate without type name hiding. See also my comments on 30/32 about whether we should mask array types differently (and yes, the lack of comments made it a bit harder to chase down types for my commentary in that mail). >=20 > Signed-off-by: Markus Armbruster > --- > docs/qapi-code-gen.txt | 14 +++++++------- > scripts/qapi-introspect.py | 24 +++++++++++++++++++++--- > 2 files changed, 28 insertions(+), 10 deletions(-) >=20 If we don't do anything to array names, then: Reviewed-by: Eric Blake If we DO touch array names, I suspect this will look a lot different, and have to drop R-b for v4. > diff --git a/docs/qapi-code-gen.txt b/docs/qapi-code-gen.txt > index ed04770..3a78cf4 100644 > --- a/docs/qapi-code-gen.txt > +++ b/docs/qapi-code-gen.txt > @@ -868,13 +868,13 @@ Example: > [Uninteresting stuff omitted...] > =20 > const char example_qmp_schema_json[] =3D "[" > - "{ \"arg-type\": \":empty\", \"name\": \"MY_EVENT\", \"meta-ty= pe\": \"event\" }, " > - "{ \"meta-type\": \"builtin\", \"name\": \"int\", \"json-type\= ": \"int\" }, " > - "{ \"meta-type\": \"builtin\", \"name\": \"str\", \"json-type\= ": \"string\" }, " > - "{ \"meta-type\": \"object\", \"name\": \":empty\", \"members\= ": [ ] }, " > - "{ \"meta-type\": \"object\", \"name\": \":obj-my-command-arg\= ", \"members\": [{ \"type\": \"UserDefOne\", \"name\": \"arg1\" } ] }, " > - "{ \"meta-type\": \"object\", \"name\": \"UserDefOne\", \"memb= ers\": [{ \"type\": \"int\", \"name\": \"integer\" }, { \"type\": \"str\"= , \"name\": \"string\" } ] }, " > - "{ \"arg-type\": \":obj-my-command-arg\", \"ret-type\": \"User= DefOne\", \"name\": \"my-command\", \"meta-type\": \"command\" } ]"; > + "{ \"arg-type\": \"0\", \"meta-type\": \"event\", \"name\": \"= MY_EVENT\" }, " > + "{ \"arg-type\": \"1\", \"meta-type\": \"command\", \"name\": = \"my-command\", \"ret-type\": \"2\" }, " > + "{ \"members\": [ ], \"meta-type\": \"object\", \"name\": \"0\= " }, " > + "{ \"members\": [{ \"name\": \"arg1\", \"type\": \"2\" } ], \"= meta-type\": \"object\", \"name\": \"1\" }, " > + "{ \"members\": [{ \"name\": \"integer\", \"type\": \"int\" },= { \"name\": \"string\", \"type\": \"str\" } ], \"meta-type\": \"object\"= , \"name\": \"2\" }, " > + "{ \"json-type\": \"int\", \"meta-type\": \"builtin\", \"name\= ": \"int\" }, " > + "{ \"json-type\": \"string\", \"meta-type\": \"builtin\", \"na= me\": \"str\" } ]"; Some churn here once you fix the sorting in 30. > + > + def _name(self, name): > + if name not in self.name_map: > + n =3D len(self.name_map) > + self.name_map[name] =3D '%s' % n When string-izing an integer, isn't it better to use: self.name_map[name] =3D '%d' % len(self.name_map) --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --CtsnxsIpEhx6s5OFK8lLi285xB2eJjuJK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVwnrIAAoJEKeha0olJ0Nq+6oH/0nSiNTCBUJ/ziddfCNZNgk7 SX6j0lS6+E7ARRJ7O0/65NBGvVeCxv+rP5Ae5c5zqSE9TFsxSf+Z2m9hCZzKlb8m O/ZjcB7K723DcRpiV68KWCw+dPRsL2F1uzq6t+ZREYnlMXaNoRgIJC3KeZ1cWwAz JtuG2x6p7ONdjuL6eacWet01Xy9Axbo2Ao4rheW7TQ3HbWnIJFtxDPhGAsnebXN1 OKRZlYWtDI/SusmhxOh/CVV0v5vJLctntKxHd2PGc9CNJ5BgKIDst0hVhtdgcnEF HnD8pT69uLB40xCZ1GIBVL5OKm+3RM+9lvBYgQ2vNWOcO7oN+h+MNqMJtKpjIjY= =28gR -----END PGP SIGNATURE----- --CtsnxsIpEhx6s5OFK8lLi285xB2eJjuJK--