From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53376) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ubzuv-0002UO-NQ for qemu-devel@nongnu.org; Mon, 13 May 2013 17:04:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ubzuu-0003Nv-33 for qemu-devel@nongnu.org; Mon, 13 May 2013 17:04:21 -0400 Received: from e23smtp09.au.ibm.com ([202.81.31.142]:56704) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ubzut-0003Nf-G2 for qemu-devel@nongnu.org; Mon, 13 May 2013 17:04:19 -0400 Received: from /spool/local by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 14 May 2013 18:01:53 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 65E902CE8053 for ; Tue, 14 May 2013 07:04:11 +1000 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r4DKo2FO24182992 for ; Tue, 14 May 2013 06:50:04 +1000 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r4DL497F000723 for ; Tue, 14 May 2013 07:04:09 +1000 From: Anthony Liguori In-Reply-To: <51915319.4090801@redhat.com> References: <1368477106-7579-1-git-send-email-aliguori@us.ibm.com> <51915319.4090801@redhat.com> Date: Mon, 13 May 2013 16:04:01 -0500 Message-ID: <87r4haa8xq.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH for-1.5 1/2] qom: aggressively optimize qom casting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, Aurelien Jarno , Andreas Faerber Paolo Bonzini writes: > Il 13/05/2013 22:31, Anthony Liguori ha scritto: >> This patch adds a small typename cache to ObjectClass. This allows >> caching positive casts within each ObjectClass. Benchmarking a >> PPC workload provided by Aurelien, this patch eliminates every >> single g_hash_table_lookup() happening during the benchmark (which >> was about 2 million per-second). >> >> With this patch applied, I get exactly the same performance (within >> the margin of error) as with --disable-qom-cast-debug. >> >> N.B. it's safe to cache typenames only from the _assert() macros >> because they are always called with string literals. > > Nice! Perhaps (for 1.6?) we can cache other results than class, so that > interfaces are sped up as well. Yes, there's no reason not to store any computed data within a class. There are very few of them within QEMU and it's very easy to get to. > Reviewed-by: Paolo Bonzini Thanks. We should leave the --disable-qom-casts present for 1.5 but I'd like to discuss reverting it for 1.6. I'll send patches once 1.6 opens up. Regards, Anthony Liguori