Don't re-check dependencies in a single run.

If a depends on b depends on c, then if when we consider building a, we have
to check b and c.  If we then are asked about a2 which depends on b, there
is no reason to re-check b and its dependencies; we already know it's done.

This takes the time to do 'redo t/curse/all' the *second* time down from
1.0s to 0.13s.  (make can still do it in 0.07s.)

'redo t/curse/all' the first time is down from 5.4s to to 4.6s.  With -j4,
from 3.0s to 2.5s.
This commit is contained in:
Avery Pennarun 2010-11-21 00:54:35 -08:00
commit 2f604b2c8f
3 changed files with 25 additions and 0 deletions

View file

@ -34,6 +34,7 @@ def _stampname(t, fromdir=None):
def stamp(t):
mark(t)
stampfile = _stampname(t)
newstampfile = _sname('stamp' + str(os.getpid()), t)
depfile = _sname('dep', t)
@ -65,6 +66,25 @@ def stamped(t, fromdir=None):
return stamptime
def mark(t, fromdir=None):
try:
open(_sname('mark', t, fromdir), 'w').close()
except IOError, e:
if e.errno == errno.ENOENT:
pass # may happen if someone deletes our .redo dir
else:
raise
_marks = {}
def ismarked(t, fromdir=None):
if _marks.get((t,fromdir)):
return True
if os.path.exists(_sname('mark', t, fromdir)):
_marks[(t,fromdir)] = True
return True
def is_generated(t):
return os.path.exists(_sname('gen', t))