[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] RFC: do we need ordered dict?

From: Eric Blake
Subject: Re: [Qemu-devel] RFC: do we need ordered dict?
Date: Mon, 23 May 2016 09:29:23 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

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: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]