From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 16 12:07:00 2007 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 214F016A403 for ; Mon, 16 Jul 2007 12:07:00 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from mxout2.cac.washington.edu (mxout2.cac.washington.edu [140.142.33.4]) by mx1.freebsd.org (Postfix) with ESMTP id F422A13C461 for ; Mon, 16 Jul 2007 12:06:59 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from smtp.washington.edu (smtp.washington.edu [140.142.32.141] (may be forged)) by mxout2.cac.washington.edu (8.13.7+UW06.06/8.13.7+UW07.06) with ESMTP id l6GC6x4L012282 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 16 Jul 2007 05:06:59 -0700 X-Auth-Received: from [192.168.10.45] (c-24-10-12-194.hsd1.ca.comcast.net [24.10.12.194]) (authenticated authid=youshi10) by smtp.washington.edu (8.13.7+UW06.06/8.13.7+UW07.03) with ESMTP id l6GC6wtA032344 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 16 Jul 2007 05:06:59 -0700 Message-ID: <469B5F61.1060805@u.washington.edu> Date: Mon, 16 Jul 2007 05:06:57 -0700 From: Garrett Cooper User-Agent: Thunderbird 2.0.0.4 (Windows/20070604) MIME-Version: 1.0 To: hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version: 5.3.2.304607, Antispam-Engine: 2.5.1.298604, Antispam-Data: 2007.7.16.44533 X-Uwash-Spam: Gauge=IIIIIII, Probability=7%, Report='__CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __STOCK_SYMBOL1 0, __STOCK_SYMBOL_X1 0, __USER_AGENT 0' Cc: Subject: Large gap between fwrite and write, and fread and read 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: Mon, 16 Jul 2007 12:07:00 -0000 Hello again Hackers, I ran some tests and I noticed a large difference in the cumulative sums of fwrite(2) vs write(3) and fread(2) vs read(3) (3-fold differences on a real machine). Please download , take a look at README for some results, and read for more details on how you can run the tests as well if curious, and feel free to send me the results if desired. If you do run the tests, please don't use the /tmp disk at all on the machine as it will most likely skew parts of the test, and please pay heed to the warning, otherwise the test box may become unusable. One thing that has me puzzled though... why is there such a large difference? Is it because fread(2) allows object by object instantiation (i.e. preallocates objects according to sizeof and returns the number of allocated figures), whereas read(3) just reads in raw lengths and returns the amount of chars scanned in? Does the same logic apply for fwrite(2) and write(3)? Thanks, -Garrett -- I really need to go to bed earlier.. haha.