From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJiNW-00077K-Jd for qemu-devel@nongnu.org; Mon, 27 Jul 2015 09:23:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZJiNV-0001mA-6P for qemu-devel@nongnu.org; Mon, 27 Jul 2015 09:23:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52974) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJiNV-0001lv-0v for qemu-devel@nongnu.org; Mon, 27 Jul 2015 09:23:37 -0400 Date: Mon, 27 Jul 2015 14:23:32 +0100 From: "Daniel P. Berrange" Message-ID: <20150727132332.GD9132@redhat.com> References: <507c11db2c97eef33de0e4f7168076d5c39f0867.1436866326.git.p.fedin@samsung.com> <87r3ntzra9.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87r3ntzra9.fsf@blackfin.pond.sub.org> Subject: Re: [Qemu-devel] [PATCH v4 2/2] QOM: object_property_add() performance improvement Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Paolo Bonzini , Peter Crosthwaite , Pavel Fedin , qemu-devel@nongnu.org, Andreas =?utf-8?Q?F=C3=A4rber?= On Mon, Jul 27, 2015 at 03:03:26PM +0200, Markus Armbruster wrote: > Pavel Fedin writes: > > > Avoid repetitive lookup of every property in array starting from 0 by adding > > one more property which caches last used index. Every time an array is > > expanded the index is picked up from this cache. > > > > The property is a uint32_t and its name is name of the array plus '#' > > ('name#'). It has getter function in order to allow to inspect it from > > within monitor. > > Do we really want '#' in property names? Elsewhere, we require names to > be id_wellformed(). I've long argued for doing that consistently[*], > but QOM still doesn't. > > I've always hated "automatic arrayification", not least because it > encodes semantics in property names. I tried to replace it[**], but > Paolo opposed it. Which makes him the go-to guy for reviewing anything > that touches it ;-P Yeah, I think the magic arrayification behaviour is pretty unpleasant. It feels like a poor hack to deal with fact that we've not got support for setting non-scalar properties. Since we're representing arrays implicitly, we have in turned created the performance problem that we're facing now because we don't explicitly track the size of the array. Now we're going to add yet more magic properties to deal this :-( Not to mention the fact that we've no type safety on the array elements we're storing eg propname[0] could be an int16, propname[1] could be a string, and so on with no checking. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|