From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4rnU-0002pL-5Q for qemu-devel@nongnu.org; Mon, 23 May 2016 11:29:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b4rnO-0000r9-4b for qemu-devel@nongnu.org; Mon, 23 May 2016 11:29:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4rnN-0000qx-UR for qemu-devel@nongnu.org; Mon, 23 May 2016 11:29:30 -0400 References: <1463998435.2087.37.camel@localhost> From: Eric Blake Message-ID: <574321D3.1000808@redhat.com> Date: Mon, 23 May 2016 09:29:23 -0600 MIME-Version: 1.0 In-Reply-To: <1463998435.2087.37.camel@localhost> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="JXeGDs18VJpd0oFhQb8SjRAOWUBnIXSqf" Subject: Re: [Qemu-devel] RFC: do we need ordered dict? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Wei, Jiangang" Cc: "qemu-devel@nongnu.org" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --JXeGDs18VJpd0oFhQb8SjRAOWUBnIXSqf Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/23/2016 04:14 AM, Wei, Jiangang wrote: > Hi all, >=20 > I found a problem about the output of 'query-version' >=20 > Actually, It's as following, > -> { "execute": "query-version" } > <- { > "return":{ > "qemu":{ > "micro":50, > "minor":6, > "major":2 > }, > "package":"" > } > } >=20 JSON has no inherent ordering of keys in a dictionary, so I see nothing that needs to be changed here. > The reason is that the member ''qemu" is regarded as Un-ordered dict. > and tdb_hash() returns the same bucket(225) for both "micro" and > "minor".=20 > and The "major" is bigger (481). >=20 > All of the above metioned introduces the disorder for major , minor and= > micro. And if we pick any different hash, the results might be in a different order again. But it doesn't make it any less correct, so I don't think an ordered dict will help anything, and would instead just cost more overhead to write and maintain. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --JXeGDs18VJpd0oFhQb8SjRAOWUBnIXSqf 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/ iQEcBAEBCAAGBQJXQyHTAAoJEKeha0olJ0Nq7zMH/jwQG/sATnnvmNmV69AA53PM yRhA1BvQtGgi2WjsDHoXh2nuQuTzwSi04XAgurzuN19TgUzztVh5G/EhwLDgsm0H vlqzuY4D+8Qga7V3kGGk8qTgirLqy7nyxeOflCrlOw4uQOqxJUBcLH0J/J7PqRTS qEFk2q0RoLsnSFEVMTAoxX2N5Cam8sXk+WtNrkpIrh0IegtcI9tn+xX/dee99fUZ 4WkjmTz2QM8HsJ4J/QUgAdUIKquQubwpNFucaddve64ktfobuHE3rOPbqGmN9VOG sjdzvxL2Xobl5uE0hLP+RyAMMzY2g3zxTVCwhJJmiBt9BWoPA8CKN+K8JBSjtz0= =LVyD -----END PGP SIGNATURE----- --JXeGDs18VJpd0oFhQb8SjRAOWUBnIXSqf--