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 <berra...@redhat.com>
> ---
>  include/qom/object.h |  44 ++++++++++
>  qom/object.c         | 233 
> +++++++++++++++++++++++++++++++++++++++++++++++++--
>  2 files changed, 270 insertions(+), 7 deletions(-)
> 
> 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];
>  
>      ObjectUnparent *unparent;
> +
> +    QTAILQ_HEAD(, ObjectProperty) properties;
>  };
>  
>  /**
[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

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton; HRB 21284 (AG Nürnberg)

Reply via email to