From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkGdJ-00060H-Jm for qemu-devel@nongnu.org; Thu, 08 Oct 2015 15:13:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkGcp-0000t9-Fo for qemu-devel@nongnu.org; Thu, 08 Oct 2015 15:13:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56268) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkGcp-0000su-4B for qemu-devel@nongnu.org; Thu, 08 Oct 2015 15:13:11 -0400 References: <1444313344-16196-1-git-send-email-berrange@redhat.com> <1444313344-16196-5-git-send-email-berrange@redhat.com> From: Eric Blake Message-ID: <5616C045.20605@redhat.com> Date: Thu, 8 Oct 2015 13:13:09 -0600 MIME-Version: 1.0 In-Reply-To: <1444313344-16196-5-git-send-email-berrange@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="kW9PHUkL8GtKoNtIt0D2uclPBw3Ohi72n" Subject: Re: [Qemu-devel] [PATCH v3 4/5] qom: replace object property list with GHashTable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Cc: Pavel Fedin , =?UTF-8?Q?Andreas_F=c3=a4rber?= This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --kW9PHUkL8GtKoNtIt0D2uclPBw3Ohi72n Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/08/2015 08:09 AM, Daniel P. Berrange wrote: > From: Pavel Fedin >=20 > ARM GICv3 systems with large number of CPUs create lots of IRQ pins. Si= nce > every pin is represented as a property, number of these properties beco= mes > very large. Every property add first makes sure there's no duplicates. > Traversing the list becomes very slow, therefore qemu initialization ta= kes > significant time (several seconds for e. g. 16 CPUs). >=20 > This patch replaces list with GHashTable, making lookup very fast. The = only > drawback is that object_child_foreach() and object_child_foreach_recurs= ive() > 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. >=20 > Signed-off-by: Daniel P. Berrange > --- > include/qom/object.h | 10 ++++-- > qom/object.c | 94 +++++++++++++++++++++++++++++++-------------= -------- > 2 files changed, 63 insertions(+), 41 deletions(-) >=20 > @@ -879,13 +898,11 @@ object_property_add(Object *obj, const char *name= , const char *type, > return ret; > } > =20 > - QTAILQ_FOREACH(prop, &obj->properties, node) { > - if (strcmp(prop->name, name) =3D=3D 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 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --kW9PHUkL8GtKoNtIt0D2uclPBw3Ohi72n Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWFsBFAAoJEKeha0olJ0NqpQQIAKzCHrSX7i/a1GQVws8Mu0Pv fuX6hasgZ+SHXWyspZSbRQ116VPrT6zmdHT/qNM2JbAeQ/e1urjOajBRMWJWZHig W79RhRpHBNueaZviqL1lGX69kHB37Q+u+EdTsVPD3/fPZ/xewDeypqFlWPRrEH4e 10Ul/UDFyRtEsSaGd4mI7kA/i581deUYoQzoLtekIgdQ9g81f9Sn2yhWmjVftVCn brgl1fuO853/4UztU67BJQJoxvsmESqh/9V4J2enR1nAqMBAP++/f6Y7utigDoDB DnUWD/Oyr6+XdJN5UObzKXDQLy0i4vpk2ZJd8JS1O9BWiBjC7x0mD43HqvcoW8I= =sfsI -----END PGP SIGNATURE----- --kW9PHUkL8GtKoNtIt0D2uclPBw3Ohi72n--