[net.bugs.4bsd] ul

frew@ucsbcsl.UUCP (James Frew) (03/28/85)

Index:	/usr/src/ucb/ul.c 4.2BSD

Description:
	Ul's system time can be cut by about 80% by letting stdio
	decide what size buffer to use and when to flush it.

	Ul's user time can be cut by about 2/3 by calling bzero()
	instead of explicitly zeroing an array before each input line
	is processed.
Repeat-By:
	Time "ul" on a large file before and after applying the
	following tweaks.
Fix:
	The following diffs are easy to find, so to save space they are
	given without the "-c" context.

	32,33d31
	< char	buf[BUFSIZ];
	< 
	92d89
	< 	setbuf(stdout, buf);
	246d242
	< 	fflush(stdout);
	320,323c316,317
	< 	for (i=0; i<MAXBUF; i++) {
	< 		obuf[i].c_char = '\0';
	< 		obuf[i].c_mode = NORMAL;
	< 	}
	---
	> 	/* following depends on NORMAL == 000 */
	> 	bzero(obuf, sizeof(obuf));
-----------------------------------------------------------------------
-- 
James Frew	{arizona,cepu,sdcarl,ucbvax}!ucsbcsl!frew
Computer Systems Lab., Univ. of Calif., Santa Barbara, CA 93106
(805) 961-2309