qom: Make info qom-tree sort children more efficientlypull-qom-2020-07-21
commit0dde9fd12fd39762ff68fca80d2f0a735d66e7bd
authorMarkus Armbruster <armbru@redhat.com>
Tue, 14 Jul 2020 16:02:02 +0000 (14 18:02 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Tue, 21 Jul 2020 15:39:37 +0000 (21 17:39 +0200)
tree509419d491fe24aa4a11f3b88ab475690fd39b2a
parent5bd929d2fff068f829688f27b54f2f159ff06eb6
qom: Make info qom-tree sort children more efficiently

Commit e8c9e65816 "qom: Make "info qom-tree" show children sorted"
sorts children the simple, stupid, quadratic way.  I thought the
number of children would be small enough for this not to matter.  I
was wrong: there are outliers with several hundred children, e.g ARM
machines nuri and smdkc210 each have a node with 513 children.

While n^2 sorting isn't noticeable in normal, human usage even for
n=513, it can be quite noticeable in certain automated tests.  In
particular, the sort made device-introspect-test even slower.  Commit
3e7b80f84d "tests: improve performance of device-introspect-test" just
fixed that by cutting back its excessive use of "info qom-tree".
Sorting more efficiently makes sense regardless, so do it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200714160202.3121879-6-armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
qom/qom-hmp-cmds.c