why is fprintf(stderr,) slow?

Michael Meissner meissner at dg_rtp.UUCP
Tue Sep 2 03:04:29 AEST 1986


In article <338 at chronon.chronon.UUCP> eric at chronon.UUCP (Eric Black) writes:
>
>Of course, the reason that it was made per character is to make sure that
>the error output in fact gets out, and is not lost in stdio buffering somewhere
>when an errant program suddenly gives up the ghost.  On BSD systems,
>at least, you can change this with the setlinebuf(3S) call, to make
>stderr use buffering.  Nowadays, with buffered stdio output less likely
>to get lost (?), perhaps it is too bad that the default is still
>to make a system call per character, rather than per call, but...
>
>On non-BSD systems you're stuck, as far as I know.

On System V.2, V.3, and the ANSI X3J11 draft you can use setvbuf (which allows
to set both the buffersize and a choice between no/line/full buffering).  Also,
I believe a pure System V.2 system buffers per call to *printf instead of per
character (but I'm not sure).

	Michael Meissner, Data General
	...{ decvax, ucbvax }!mcnc!rti-sel!dg_rtp!meissner



More information about the Comp.unix mailing list