From owner-freebsd-hackers@FreeBSD.ORG Sun Nov 11 17:52:32 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 4248616A417 for ; Sun, 11 Nov 2007 17:52:32 +0000 (UTC) (envelope-from randyhyde@earthlink.net) Received: from elasmtp-mealy.atl.sa.earthlink.net (elasmtp-mealy.atl.sa.earthlink.net [209.86.89.69]) by mx1.freebsd.org (Postfix) with ESMTP id 1AEDF13C4BF for ; Sun, 11 Nov 2007 17:52:31 +0000 (UTC) (envelope-from randyhyde@earthlink.net) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=ekTsA8qyoaE50aLCC04hE41bByJjkUIemD2x695UAIl9iyhLCCYTOFhzR86HFPjK; h=Received:Message-ID:From:To:References:Subject:Date:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Priority:X-MSMail-Priority:X-Mailer:X-MimeOLE:X-ELNK-Trace:X-Originating-IP; Received: from [66.215.252.78] (helo=pentiv) by elasmtp-mealy.atl.sa.earthlink.net with asmtp (Exim 4.34) id 1IrGyt-0001WY-QW for freebsd-hackers@freebsd.org; Sun, 11 Nov 2007 12:52:24 -0500 Message-ID: <002701c8248b$9c2b8110$6302a8c0@pentiv> From: "Randall Hyde" To: References: <000701c82253$b3a8c030$6302a8c0@pentiv> <20071108225238.GB22005@dan.emsphone.com> <4734061D.9000606@freebsd.org> Date: Sun, 11 Nov 2007 09:52:21 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1896 X-ELNK-Trace: eba5e0c9192a36dcd6dd28457998182d7e972de0d01da94071230d9d80a435df3af18fbfa1f579e2350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 66.215.252.78 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: Sun, 11 Nov 2007 17:52:32 -0000 Hi All, Well, I've done some sleuthing and discovered some issues. First, the "dd" command produced approximately the same results everyone else was getting. So I rewrote a version of my test code in C using the stdlib "read" call and it had really great performance. Not understanding why C's code was so much faster, I dug into the source code and discovered that open/read/write/etc. use *buffered* I/O (which explains why "dd" performs so well). At this point I'm not sure why FreeBSD's API call is so slow (btw, it's not the system call that's responsible, if I make several additional API calls on each read, e.g., doing lseeks, this has only a marginal impact on performance). But it's pretty clear that if I expect reasonable performance in my own library I'm going to have to do the same thing that glib does and switch over to buffered I/O. Pain in the butt, but there's nothing else to do at this point. Cheers, Randy Hyde