Large gap between fwrite and write, and fread and read

看板FB_hackers作者時間18年前 (2007/07/24 11:05), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/4 (看更多)
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. _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
文章代碼(AID): #16fMnp00 (FB_hackers)
文章代碼(AID): #16fMnp00 (FB_hackers)