Final postscript on the printf() versus puts() debate

John Gilmore gnu at hoptoad.uucp
Sun Mar 27 22:43:30 AEST 1988


One thing it seems everybody missed is that if printf() is slower than
puts(), the thing to do is not to rewrite all your programs to use puts(),
or change the compiler to convert printf() to puts(); the thing to do is
speed up the common cases of printf()!

Chris Aoki and I did this at Sun, years ago, when a new-hire in the
compiler group was wasting his time changing printf()s to puts()s.  An
hour's worth of work resulted in speeding up *every* program, not just
the ones we had time to manually edit puts()'s into.  It's now about
equally fast on Suns to printf() a string or puts() it, as it ought to
be.  After all, it's really the same loop, with one extra test for %!
-- 
{pyramid,ptsfa,amdahl,sun,ihnp4}!hoptoad!gnu			  gnu at toad.com
		"Watch me change my world..." -- Liquid Theatre



More information about the Comp.lang.c mailing list