Speed of read vs. fread
Peter Gross
pag at hao.UUCP
Wed Jan 23 16:12:33 AEST 1985
> Which is faster, read/write or fread/fwrite?
Well, you didn't specify on which version of Unix; that might make a difference.
I can speak for 4.2bsd. We have a production job here that was important
enough and taking long enough that our director was requesting that we shut
the system down while this job ran. We decided that was extreme and wanted
to see if we could speed it up. Profiling showed it spent a great deal of
time in fread()/fwrite(). We checked the code, and lo and behold, fread/fwrite
do single getc/putc's in a loop. Converting to read/write made the program
run about 3 times faster.
--peter gross
hao!pag
More information about the Comp.unix
mailing list