From owner-freebsd-hackers@FreeBSD.ORG Fri Nov 9 11:03:34 2007 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C75BA16A468 for ; Fri, 9 Nov 2007 11:03:34 +0000 (UTC) (envelope-from dinesh@alphaque.com) Received: from ns2.alphaque.com (mail.qubeconnect.com [202.190.74.25]) by mx1.freebsd.org (Postfix) with SMTP id 1094C13C4A8 for ; Fri, 9 Nov 2007 11:03:33 +0000 (UTC) (envelope-from dinesh@alphaque.com) Received: (qmail 44387 invoked by uid 0); 9 Nov 2007 10:36:47 -0000 Received: from lucifer.net-gw.com (HELO prophet.alphaque.com) (202.190.74.25) by lucifer.net-gw.com with SMTP; 9 Nov 2007 10:36:47 -0000 Received: from prophet.alphaque.com (localhost [127.0.0.1]) by prophet.alphaque.com (8.13.8/8.13.4) with ESMTP id lA9AZKKF087274; Fri, 9 Nov 2007 18:35:21 +0800 (MYT) (envelope-from dinesh@alphaque.com) Date: Fri, 9 Nov 2007 18:35:20 +0800 From: Dinesh Nair To: Dan Nelson Message-ID: <20071109183520.07a6b35a@prophet.alphaque.com> In-Reply-To: <20071108225238.GB22005@dan.emsphone.com> References: <000701c82253$b3a8c030$6302a8c0@pentiv> <20071108225238.GB22005@dan.emsphone.com> Organization: Alphaque. Anytime. Anywhere. X-Mailer: Sylpheed-Claws 2.3.1 (GTK+ 2.8.12; i386-portbld-freebsd6.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org, Randall Hyde Subject: Re: Some FreeBSD performance Issues X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Nov 2007 11:03:34 -0000 On Thu, 8 Nov 2007 16:52:38 -0600, Dan Nelson wrote: > In the last episode (Nov 08), Randall Hyde said: > > It appears that character-at-a-time file I/O is *exceptionally* slow. > > Yes, I realize that when processing large files I really ought to be > > doing block/buffered I/O to get the best performance, but for certain > > library routines I've written it's been far more convenient to do > > character-at-a-time I/O rather than deal with all the buffering > > issues. In the past, while slower, this character-at-a-time paradigm > > has provided reasonable, though not stellar, performance under > > Windows and Linux. However, with the port to FreeBSD I'm seeing a > > three-orders-of-magnitude performance loss. Here's my little test > > program: > [...] > > The "fileio.open" call is basically a bsd.open( "socket.h", > > bsd.O_RDONLY ); API call. The socket.h file is about 19K long (it's > > from the FreeBSD include file set). In particular, I would draw your > > attention to the first two tests that do character-at-a-time I/O. The > > difference in performance > > What timings does > "dd if=/usr/include/sys/socket.h of=/dev/null ibs=1 obs=64k" report? > It takes about .4 sec on my non-idle dual pIII-900 system. Try > truss'ing your program as it runs; maybe the program is doing some > extra syscalls you aren't aware of? > on FreeBSD 6.2-RELEASE, it returns, dd if=/usr/include/sys/socket.h of=/dev/null ibs=1 obs=64k 18426+0 records in 0+1 records out 18426 bytes transferred in 0.070472 secs (261466 bytes/sec) -- Regards, /\_/\ "All dogs go to heaven." dinesh@alphaque.com (0 0) http://www.openmalaysiablog.com/ +==========================----oOO--(_)--OOo----==========================+ | for a in past present future; do | | for b in clients employers associates relatives neighbours pets; do | | echo "The opinions here in no way reflect the opinions of my $a $b." | | done; done | +=========================================================================+