From: "Daniel P. Berrange" <berrange@redhat.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH RFC 1/7] qom: allow properties to be registered against classes
Date: Fri, 11 Sep 2015 17:09:56 +0100 [thread overview]
Message-ID: <20150911160956.GC1274@redhat.com> (raw)
In-Reply-To: <55E72154.7070404@suse.de>
On Wed, Sep 02, 2015 at 06:18:28PM +0200, Andreas Färber wrote:
> Am 26.08.2015 um 14:03 schrieb Daniel P. Berrange:
> > When there are many instances of a given class, registering
> > properties against the instance is wasteful of resources. The
> > majority of objects have a statically defined list of possible
> > properties, so most of the properties are easily registerable
> > against the class. Only those properties which are conditionally
> > registered at runtime need be recorded against the klass.
> >
> > Registering properties against classes also makes it possible
> > to provide static introspection of QOM - currently introspection
> > is only possible after creating an instance of a class, which
> > severely limits its usefulness.
> >
> > This impl only supports simple scalar properties. It does not
> > attempt to allow child object / link object properties against
> > the class. There are ways to support those too, but it would
> > make this patch more complicated, so it is left as an exercise
> > for the future.
> >
> > Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> > ---
> > include/qom/object.h | 44 ++++++++++
> > qom/object.c | 233 +++++++++++++++++++++++++++++++++++++++++++++++++--
> > 2 files changed, 270 insertions(+), 7 deletions(-)
> >
[snip]
> Did you do any benchmarks on performance impact?
I created a crude test benchmark, consisting of an object which
has 20 string properties registered against it.
I then timed how long it took to create and free 1,000,000 instances
of this object.
- Props registered against object: 8.5 seconds
- Props registered against class: 1.1 seconds
I created a second test that also timed object accesses but there
was no measurable difference.
As expected, there is a considerable memory benefit - with 20 properties,
each object consumed 2600 bytes less, when registered to the class, or
approx 130 bytes less per property.
AFAICT, the performance benefit is essentially due to not having the
overhead of mallocing the ObjectProperty struct and its contents for
every new object instance.
BTW in testing this I found the g_mem_set_vtable() call has a
quite considerable performance penalty, even when tracing is not
compiled in. It added 17% to my test running time! We might want
to investigate that performance impact in QEMU as a whole and
check that it is actually acceptable for real deployment.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
next prev parent reply other threads:[~2015-09-11 16:10 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-26 12:03 [Qemu-devel] [PATCH RFC 0/7] Making QOM introspectable Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 1/7] qom: allow properties to be registered against classes Daniel P. Berrange
2015-09-02 16:18 ` Andreas Färber
2015-09-03 15:49 ` Daniel P. Berrange
2015-09-03 16:37 ` Markus Armbruster
2015-09-03 16:41 ` Andreas Färber
2015-09-03 17:02 ` Markus Armbruster
2015-09-03 17:09 ` Daniel P. Berrange
2015-09-03 17:21 ` Andreas Färber
2015-09-03 17:25 ` Daniel P. Berrange
2015-09-04 6:56 ` Markus Armbruster
2015-09-07 12:54 ` Paolo Bonzini
2015-09-11 16:09 ` Daniel P. Berrange [this message]
2015-09-04 21:38 ` Marc-André Lureau
2015-09-07 8:46 ` Daniel P. Berrange
2015-09-07 13:11 ` Andreas Färber
2015-09-07 13:17 ` Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 2/7] hostmem: register properties against the class instead of object Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 3/7] rng: " Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 4/7] tpm: " Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 5/7] cpu: avoid using object instance state in property getter Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 6/7] x86-cpu: register properties against the class instead of object Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 7/7] machine: " Daniel P. Berrange
2015-09-02 9:05 ` [Qemu-devel] [PATCH RFC 0/7] Making QOM introspectable Daniel P. Berrange
2015-09-02 11:14 ` Markus Armbruster
2015-09-02 16:16 ` Andreas Färber
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=20150911160956.GC1274@redhat.com \
--to=berrange@redhat.com \
--cc=afaerber@suse.de \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).