From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49386) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYJpq-0004yD-DY for qemu-devel@nongnu.org; Sun, 19 Jun 2011 11:22:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QYJpp-0002rB-Hh for qemu-devel@nongnu.org; Sun, 19 Jun 2011 11:22:50 -0400 Received: from mail-gx0-f173.google.com ([209.85.161.173]:62855) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYJpp-0002r7-FD for qemu-devel@nongnu.org; Sun, 19 Jun 2011 11:22:49 -0400 Received: by gxk26 with SMTP id 26so180679gxk.4 for ; Sun, 19 Jun 2011 08:22:48 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1308495273-23383-1-git-send-email-avi@redhat.com> References: <1308495273-23383-1-git-send-email-avi@redhat.com> Date: Sun, 19 Jun 2011 16:22:48 +0100 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] Optimize screendump List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: qemu-devel@nongnu.org On Sun, Jun 19, 2011 at 3:54 PM, Avi Kivity wrote: > When running kvm-autotest, fputc() is often the second highest (sometimes= #1) > function showing up in a profile. =A0This is due to fputc() locking the f= ile > for every byte written. > > Optimize by using fputc_unlocked(). =A0Since the file is local to the cal= ler, > clearly no locking is needed. =A0According to the manual, _GNU_SOURCE is = all > that's needed for the function to be present. > > Signed-off-by: Avi Kivity > --- > =A0hw/vga.c | =A0 =A06 +++--- > =A01 files changed, 3 insertions(+), 3 deletions(-) "The nonstandard *_unlocked() variants occur on a few Unix systems, and are available in recent glibc. They should probably not be used." I wonder if this will break non-Linux platforms. Perhaps buffer an entire row of pixels instead and only fwrite(3) at the end of the outer loop. Stefan