why is fprintf(stderr,) slow?

Jim Webb jrw at hropus.UUCP
Tue Aug 19 03:47:07 AEST 1986


> I was doing about 500 fprintf(stderr, "blah...\n");
> 
> The program was taking 35 or 40 seconds of system time which was pretty
> high.  I then commented out the fprintf's and the program took 17 or 18
> system time seconds (it was doing a lot of disk accesses).

Standard error is unbuffered, eg, one char at a time, so it makes one
write system call per character, hence its slowness.
-- 
Jim Webb             "Out of phase--get help"         ihnp4!houxm!hropus!jrw



More information about the Comp.unix mailing list