[net.news] massive rn speedup

dave@lsuc.UUCP (David Sherman) (03/06/85)

Somebody asked a while back about ways of "speeding up UNIX",
and I posted a reply about using setbuf to buffer stdout. I decided
to take my own advice and try it on rn.

The results on our site are amazing. (This is a Perkin-Elmer 3220
running v7, hardwired at 19,200 baud; your mileage may vary.)
I changed rn to spit out articles a line at a time instead of
a character at a time. Now articles flash up in no time instead
of slowing down for all those write(2) system calls (say 1,500
of them per screen).

If enough people want my changes, I'll post them; or you can
do it yourself. All it takes is a setbuf on stdout at the
beginning of main(), and fflush(stdout)'s whenever you want
your stuff to come out (grep put and grep printf).

I introduced one non-portable change, to make it easy. That was
to compile the source with -Dprintf=Dprintf, and write:
	Dprintf(str,a,b,c,d,e,f,g,h,i,j)
		register char *str;
	{
	#undef printf
		printf(str,a,b,c,d,e,f,g,h,i,j);
		fflush(stdout);
	}

This is not portable to all machines, although I believe it
works on VAXen and many others. If it doesn't work for you,
and you want the particular printf calls buffered, you have
to go in with the editor and stick in fflush(stdout) where appropriate.

Dave Sherman
The Law Society of Upper Canada
Toronto
-- 
{utzoo pesnta nrcaero utcs hcr}!lsuc!dave
{allegra decvax ihnp4 linus}!utcsri!lsuc!dave