Re: Patch: cut 'make dep' time in half

Adam D. Bradley (
Fri, 6 Dec 1996 17:58:10 -0500 (EST)

> One question about a couple of lines in the patch:
> > +set -e
> > +dir_top=`pwd`
> > +dir_list=`find $* -name '*.[chS]' -print | sed -e 's/^\(.*\)\/[^\/].*$/\1/p' | sort -u`
> > +for dir in $dir_list ; do
> > + cd $dir
> > + $dir_top/scripts/mkdep *.[chS] > .depend
> > + cd $dir_top
> > +done
> Couldn't the last two lines be switched for a small speed improvement?
> -Tom Kludy

the $dir_list creation would have to generate absolute pathnames...

or, perhaps this could work:
for dir in $dir_list ; do
- cd $dir
+ cd $dir_top/$dir
$dir_top/scripts/mkdep *.[chS] > .depend
- cd $dir_top

How much speed improvement? Well, the difference between executing one
shell internal command and two shell internal commands; either way, it
needs to get back to the source root directory, then delve into the tree.

Do pushd and popd work with inodes or paths? If they worked with inodes,
we could shave another hair's breadth off by doing this:
cd $dir_top
for dir in $dir_list ; do
cd $dir
$dir_top/scripts/mkdep *.[chS] > .depend

Are we splitting hairs here? (Given the scale of CPU electronics, I guess
split hairs are still pretty big... ;-)


He feeds on ashes; a deluded mind has led him    Adam Bradley, UNCA Senior
astray, and he cannot deliver himself or say,             Computer Science
"Is there not a lie in my right hand?"   Isaiah 44:20      <><