[net.bugs.4bsd] 4.[123]/System V "find path ... -type d -whatever ..." too slow

ado@elsie.UUCP (Arthur David Olson) (09/10/86)

Index:	bin/find Fix

Description:
	Commands of the form
		find path ... -type d -whatever ...
	are too slow.

Repeat-By:
		Script started on Wed Sep 10 09:31:06 1986
		Warning: no access to tty; thus no job control in this shell...
		% set time 0
		% /usr/bin/find /d -type d -print | wc -l
		    589
		2.1u 14.1s 0:37 43% 8+13k 750+125io 4pf+0w
		% 
		script done on Wed Sep 10 09:32:06 1986
	...where you should replace "/d" above with some suitably large file
	system.

Fix:
	Make the addition conditioned on "OLDVERSION" below to the
	function "descend" in "find.c".  (The original code is from the
	4.1BSD version of find.c.)

> 	(*exlist->F)(exlist);
> 	if((Statb.st_mode&S_IFMT)!=S_IFDIR)
> 		return(1);
> #ifndef OLDVERSION
> 	if (Statb.st_nlink == 2 && exlist->F == and &&
> 		exlist->L->F == type && ((int) (exlist->L->L)) == S_IFDIR)
> 			return 1;
> #endif /* !OLDVERSION */
> 
> 	for(c1 = name; *c1; ++c1);

	After making the change, note the performance difference:
		Script started on Wed Sep 10 09:32:39 1986
		Warning: no access to tty; thus no job control in this shell...
		% set time 0
		% /usr/local/find /d -type d -print | wc -l
		    589
		1.1u 4.6s 0:07 80% 8+11k 56+60io 4pf+0w
		% 
		script done on Wed Sep 10 09:33:08 1986
--
UNIX is a registered trademark of AT&T.
System V is a trademark of AT&T.
Bug/s is a Volkswagen/Warner Brothers trademark.
Path is a Port Authority trademark.
--
	UUCP: ..decvax!seismo!elsie!ado   ARPA: elsie!ado@seismo.ARPA
	DEC, VAX, Elsie & Ado are Digital, Borden & Ampex trademarks.