On 10/08/2015 08:09 AM, Daniel P. Berrange wrote:
> From: Pavel Fedin
>
> ARM GICv3 systems with large number of CPUs create lots of IRQ pins. Since
> every pin is represented as a property, number of these properties becomes
> very large. Every property add first makes sure there's no duplicates.
> Traversing the list becomes very slow, therefore qemu initialization takes
> significant time (several seconds for e. g. 16 CPUs).
>
> This patch replaces list with GHashTable, making lookup very fast. The only
> drawback is that object_child_foreach() and object_child_foreach_recursive()
> cannot modify their objects during traversal, since GHashTableIter does not
> have modify-safe version. However, the code seems not to modify objects via
> these functions.
>
> Signed-off-by: Daniel P. Berrange
> ---
> include/qom/object.h | 10 ++++--
> qom/object.c | 94 +++++++++++++++++++++++++++++++---------------------
> 2 files changed, 63 insertions(+), 41 deletions(-)
>
> @@ -879,13 +898,11 @@ object_property_add(Object *obj, const char *name, const char *type,
> return ret;
> }
>
> - QTAILQ_FOREACH(prop, &obj->properties, node) {
> - if (strcmp(prop->name, name) == 0) {
> - error_setg(errp, "attempt to add duplicate property '%s'"
> + if (g_hash_table_contains(obj->properties, name)) {
> + error_setg(errp, "attempt to add duplicate property '%s'"
> " to object (type '%s')", name,
> object_get_typename(obj));
Indentation is now off on the unchanged lines.
Reviewed-by: Eric Blake
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org