From: Eric Blake <eblake@redhat.com>
To: "Wei, Jiangang" <weijg.fnst@cn.fujitsu.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] RFC: do we need ordered dict?
Date: Mon, 23 May 2016 09:29:23 -0600 [thread overview]
Message-ID: <574321D3.1000808@redhat.com> (raw)
In-Reply-To: <1463998435.2087.37.camel@localhost>
[-- Attachment #1: Type: text/plain, Size: 1133 bytes --]
On 05/23/2016 04:14 AM, Wei, Jiangang wrote:
> Hi all,
>
> I found a problem about the output of 'query-version'
>
> Actually, It's as following,
> -> { "execute": "query-version" }
> <- {
> "return":{
> "qemu":{
> "micro":50,
> "minor":6,
> "major":2
> },
> "package":""
> }
> }
>
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".
> and The "major" is bigger (481).
>
> 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.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2016-05-23 15:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-23 10:14 [Qemu-devel] RFC: do we need ordered dict? Wei, Jiangang
2016-05-23 15:29 ` Eric Blake [this message]
2016-05-31 9:28 ` Daniel P. Berrange
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=574321D3.1000808@redhat.com \
--to=eblake@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=weijg.fnst@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.