Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DNXAz-0003JH-90 for qemu-devel@nongnu.org; Mon, 18 Apr 2005 10:24:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DNXAk-0003Bw-HL for qemu-devel@nongnu.org; Mon, 18 Apr 2005 10:24:28 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DNXAi-00031W-Qe for qemu-devel@nongnu.org; Mon, 18 Apr 2005 10:24:20 -0400 Received: from [212.250.162.17] (helo=mta09-winn.mailhost.ntl.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DNX7V-0003MG-FS for qemu-devel@nongnu.org; Mon, 18 Apr 2005 10:21:01 -0400 Message-ID: <4263C1E5.4070601@manchester.ac.uk> Date: Mon, 18 Apr 2005 15:19:17 +0100 From: Ian Rogers MIME-Version: 1.0 Subject: Re: [Qemu-devel] Profiling Qemu for speed? References: <20050418083542.45378.qmail@web54110.mail.yahoo.com> <42638306.4050200@cs.man.ac.uk> <95a144a538f61473783743fa426580a0@axiros.com> In-Reply-To: <95a144a538f61473783743fa426580a0@axiros.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Daniel Egger , qemu-devel@nongnu.org Sorry, I was responding to Karl Magdsick's point about the cost of switch statements relating to Nathaniel G.H.'s point about the cost of translation/generation. FDO works in the case of interpreters and translators from my experience as code sequences are pretty predictable things (you just don't tend to choose instructions at random). Improving dynamically generated code is the best way to improve performance, as that's where you spend your time. However, the time spent compiling means you only want to optimise hot spots. Well thought out simple just-in-time compilation is often very hard to beat with an optimising compiler, for example, knowing your target architecture well means you can get a really good static register mapping to the host architecture. These lessons are well known in the literature. I'd still be interested to know if the translator's profiled performance improved using FDO. I have results from writing things in Java, where FDO is par for the course, but they hardly apply to QEMU/GCC. Regards, Ian Rogers -- http://www.binarytranslator.org/ Daniel Egger wrote: > On 18.04.2005, at 11:51, Ian Rogers wrote: > >> I'm not sure if you can get GCC to generate code sequences like this, >> but you probably at least need to use the -fprofile-generate and >> -fprofile-use options >> http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html > > > Feedback optimisation (FDO) will not work for two reasons: > a) qemu itself is something like a realtime compiler so FDO > will only speed up the compiler but not the generated code > b) FDO will only provide speed boosts if the feedback phase > has a chance to analyse a representative work pattern that > is hopefully also repetitive > > After all FDO is mostly about making a tradeoff size/speed > and rearranging code (mostly branches) to avoid branch > mispredictions of the CPU. > > Servus, > Daniel