Received: from eggs.gnu.org ([2001:4830:134:3::10]:59997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0Rxt-0004D5-Qs for qemu-devel@nongnu.org; Thu, 04 Jun 2015 06:01:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0Rxq-0007Xh-KA for qemu-devel@nongnu.org; Thu, 04 Jun 2015 06:01:33 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0Rxq-0007UU-FE for qemu-devel@nongnu.org; Thu, 04 Jun 2015 06:01:30 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NPE00ASAZUF9R50@mailout1.w1.samsung.com> for qemu-devel@nongnu.org; Thu, 04 Jun 2015 11:01:27 +0100 (BST) From: Pavel Fedin References: <012f01d09e99$016ab660$04402320$@samsung.com> In-reply-to: Date: Thu, 04 Jun 2015 13:01:26 +0300 Message-id: <018701d09ead$6c5624a0$45026de0$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: quoted-printable Content-language: ru Subject: Re: [Qemu-devel] Ping: [PATCH] qobject: object_property_add() performance improvement List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'Peter Crosthwaite' Cc: qemu-devel@nongnu.org, 'Luiz Capitulino' Hello! > >> + void *v =3D g_malloc0(sizeof(uint32_t)); > >> + >=20 > Can you allocate name_no_array here along with the count in a small > struct to save on some allocs and memcpys? How can i? Here i allocate persistent storage space for the property, = which is kept along. And name_no_array is a temporary buffer which is = freed after usage because property names are copied when respective = properties are added. > >> + count =3D object_property_add_single(obj, name, = "uint32", > >> + = property_get_uint32_ptr, NULL, >=20 > Do you need to register the getter or can you make it completely > opaque instead?=20 I don't need getter, but i decided to register it just in case, because = i suggest that it could be useful for example for manual object = inspection using monitor. Does monitor have this capability? > Alternatively can you register the setter and use > set/get instead of going hands on with the property opaque pointer? I wanted to do this but i remember having something like = object_property_get_int() function but missing object_property_set_int() = counterpart (sorry i may have forgotten the exact names) because = apparently settable properties start only from qdev class. I decided not = to write too much code for a single use case. It's even slightly faster = to use a pointer. And by design this property is supposed to be = read-only, because anyway setting it from outside isn't a good idea. Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia