Speed of read vs. fread

Bob Lied lied at ihlts.UUCP
Sun Jan 20 12:36:29 AEST 1985


Which is faster, read/write or fread/fwrite?

I've been told that fread/fwrite is faster because
it buffers.  On the other hand, I've been told that
read/write is faster because (a) read always does
a one block read-ahead if it can and (b) it avoids
the overhead of the fread/fwrite abstraction.

Of the few examples I know personally, read/write
seems to win, but I'm not really convinced.

Given a choice, and doing I/O in chunks instead of
characters, which should I use for performance?
Please explain your selection, and no lectures on
tuning too early, OK?

	Bob Lied	ihnp4!ihlts!lied



More information about the Comp.unix mailing list