Received: from eggs.gnu.org ([2001:4830:134:3::10]:47264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c2DXd-0004r9-34 for qemu-devel@nongnu.org; Thu, 03 Nov 2016 04:38:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c2DXZ-0007L7-6L for qemu-devel@nongnu.org; Thu, 03 Nov 2016 04:38:33 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:36251) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c2DXY-0007Kx-W3 for qemu-devel@nongnu.org; Thu, 03 Nov 2016 04:38:29 -0400 Received: by mail-wm0-x242.google.com with SMTP id c17so6765815wmc.3 for ; Thu, 03 Nov 2016 01:38:28 -0700 (PDT) Sender: Paolo Bonzini References: <1478103841-8686-1-git-send-email-pbonzini@redhat.com> <20161103061619.GB8860@lemon> From: Paolo Bonzini Message-ID: Date: Thu, 3 Nov 2016 09:38:24 +0100 MIME-Version: 1.0 In-Reply-To: <20161103061619.GB8860@lemon> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH for-2.8?] rules.mak: speedup save-vars load-vars List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org On 03/11/2016 07:16, Fam Zheng wrote: > On Wed, 11/02 17:24, Paolo Bonzini wrote: >> Unnesting variables spends a lot of time parsing and executing foreach >> and if functions. Because actually very few variables have to be >> saved and restored, a good strategy is to remember what has to be done >> in load-vars, and only iterate the right variables in load-vars. >> For save-vars, unroll the foreach loop to provide another small >> improvement. >> >> This speeds up a "noop" build from around 15.5 seconds on my laptop >> to 11.7 (25% roughly). >> >> Signed-off-by: Paolo Bonzini >> --- >> I'm wondering if this would be acceptable for 2.8. > > I think that's fine if you don't want to bear the slowness in 2.8. But TBH I > haven't really noticed this as an issue myself. Anyway, > > Reviewed-by: Fam Zheng > >> I also have sent patches to GNU make that save another >> 20%, down to 9.8 seconds. > > Wow, is there a link to the patch? In theory it would be http://lists.gnu.org/archive/html/bug-make/2016-10/index.html but I cannot see it there yet. Anyway it's not rocket science: use strchr instead of a hand-rolled while loop, improve hash functions, and an optimized version of strpbrk using SSE2. Paolo