Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Jul 2007 05:06:57 -0700
From:      Garrett Cooper <youshi10@u.washington.edu>
To:        hackers@freebsd.org
Subject:   Large gap between fwrite and write, and fread and read
Message-ID:  <469B5F61.1060805@u.washington.edu>

next in thread | raw e-mail | index | archive | help
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 
<http://students.washington.edu/youshi10/posted/fat.tgz>, 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?469B5F61.1060805>