From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXAk4-0008Vp-SX for qemu-devel@nongnu.org; Wed, 02 Sep 2015 12:18:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXAk1-0002Af-Lq for qemu-devel@nongnu.org; Wed, 02 Sep 2015 12:18:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:51886) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXAk1-0002AZ-FI for qemu-devel@nongnu.org; Wed, 02 Sep 2015 12:18:29 -0400 References: <1440590594-5514-1-git-send-email-berrange@redhat.com> <1440590594-5514-2-git-send-email-berrange@redhat.com> From: =?UTF-8?Q?Andreas_F=c3=a4rber?= Message-ID: <55E72154.7070404@suse.de> Date: Wed, 2 Sep 2015 18:18:28 +0200 MIME-Version: 1.0 In-Reply-To: <1440590594-5514-2-git-send-email-berrange@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH RFC 1/7] qom: allow properties to be registered against classes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Cc: Markus Armbruster 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. >=20 > 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. >=20 > 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. >=20 > Signed-off-by: Daniel P. Berrange > --- > include/qom/object.h | 44 ++++++++++ > qom/object.c | 233 +++++++++++++++++++++++++++++++++++++++++++= ++++++-- > 2 files changed, 270 insertions(+), 7 deletions(-) >=20 > diff --git a/include/qom/object.h b/include/qom/object.h > index 807978e..068162e 100644 > --- a/include/qom/object.h > +++ b/include/qom/object.h > @@ -383,6 +383,8 @@ struct ObjectClass > const char *class_cast_cache[OBJECT_CLASS_CAST_CACHE]; > =20 > ObjectUnparent *unparent; > + > + QTAILQ_HEAD(, ObjectProperty) properties; > }; > =20 > /** [snip] I had suggested exactly this looong time ago, but Anthony opposed it. I don't quite remember why... Did you do any benchmarks on performance impact? Regards, Andreas --=20 SUSE Linux GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Felix Imend=F6rffer, Jane Smithard, Graham Norton; HRB 21284 (AG N=FC= rnberg)