On Sat, Mar 22, 2003 at 11:14:48PM +0900, Jim Weirich wrote: > On Sat, 2003-03-22 at 05:39, Brian Candler wrote: > > > It's no more expensive to calculate than listing the dependencies > > explicitly. But I think it could be worth caching; say for example you have > > 1000 source files, each of which depends on > > > > task :includes => ['header1.h', 'header2.h', 'header3.h' ...] > > > > then you have N*M stat() calls to do, even if everything is up to date. > > I'm a little worried that caching timestamps may miss some > dependencies. I'll have to think this through. My worries may be > misplaced. I never said it was easy :-) AFAICS if Task#timestamp is defined as max(@prerequisites.timestamps) then changing any timestamp means invalidating or updating the timestamps of those tasks which have this one as a prerequisite, recursively. Doing that efficiently might mean changing the data structures. But if done, I think timestamp can become an instance variable. Incidentally, I just noticed: def timestamp File.new(name.to_s).mtime end Wouldn't File.stat(name.to_s).mtime be better? File.new actually opens the file in read mode, I believe. Regards, Brian.