qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH RFC 1/7] qom: allow properties to be registered


From: Daniel P. Berrange
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
User-agent: Mutt/1.5.23 (2014-03-12)

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 <address@hidden>
> > ---
> >  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 :|



reply via email to

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