[net.bugs.4bsd] speedup of tcsh

johanw@ttds.UUCP (Johan Wide'n) (04/04/85)

Index:
	/usr/src/local/tcsh/sh.exec.c
Description:
A little over a year ago Paul Placeway posted an enhancement to csh.
These enhancements built upon Ken Greers modifications of csh. The result
is called tcsh.

There was a problem with the enhancements as distributed: Login took a
very long time. Some debugging shows that tcsh spends almost all it's time
in
	rehash
during login. I finally got around too fixing this. When a rehash is performed
all directories in 'path' (except '.') are read. As distributed tcsh checks
that a file in 'path' is executable before permitting it to enter the
hash table. It is this check (system call access()) that is responsible
for the long time spent in dohash(). As almost all files in 'path' are
executable no great harm is done by eliminating this code.

Fix:

*** /tmp/,RCSt1013839	Thu Mar 28 15:04:39 1985
--- sh.exec.c	Thu Mar 28 14:57:18 1985
***************
*** 285,297
  			if (*(dp->d_name) == '.')
  				continue;
  
- 			strcpy (fnamebuf, *pv);
- 			strcat (fnamebuf, "/");
- 			strcat (fnamebuf, dp->d_name);
- 
- 			if (access(fnamebuf, 1)) /* if not exe file */
- 				continue;
- 
  			xhash[hash(dp->d_name)] |= (1 << i);
  			tw_add_comm_name (dp->d_name);
  		}

--- 285,290 -----
  			if (*(dp->d_name) == '.')
  				continue;
  
  			xhash[hash(dp->d_name)] |= (1 << i);
  			tw_add_comm_name (dp->d_name);
  		}
End of fix.

johanw@ttds.UUCP                Johan Widen
				KTH
				TTDS
				S-100 44 Stockholm
				SWEDEN