qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 04/12] i386: Register feature bit properties as class prop


From: Markus Armbruster
Subject: Re: [PATCH v2 04/12] i386: Register feature bit properties as class properties
Date: Tue, 15 Dec 2020 15:11:06 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Eduardo Habkost <ehabkost@redhat.com> writes:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

This is significantly more than just "simpler and easier".

The other day, I played with the QMP core to reduce its appetite for
malloc.  I came up with patches that should approximately halve it, and
felt quite pleased with myself.  I looked for a simple test to
demonstrate the effect.  Something with plenty of output.  Hmm, why not
query-cpu-definitions, it produces about 32KiB.  Instrument, instrument,
run, ... whaaaat?!?

My patches save some 7000 allocations (670 KiB total), roughly matching
my expectations.

Turns out this is a drop in the bucket: query-cpu-definitions still
takes some 180,000 allocations (almost 12 MiB total).  They're hiding
behind this line in qmp_query_cpu_definitions():

    g_slist_foreach(list, x86_cpu_definition_entry, &cpu_list);

The line takes more than a quarter second for me.

Hogging the main loop for a quarter second is not good.

Eduardo's patch reduces run time to 0.02 seconds (40,000 allocations, 9
MiB total).  It's a smaller pig now.




reply via email to

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