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:
parent
de042fc2f2
commit
2f604b2c8f
3 changed files with 25 additions and 0 deletions
|
|
@ -5,6 +5,8 @@ from helpers import debug, err, mkdirp, unlink
|
||||||
|
|
||||||
|
|
||||||
def _dirty_deps(t, depth, fromdir):
|
def _dirty_deps(t, depth, fromdir):
|
||||||
|
if state.ismarked(t, fromdir):
|
||||||
|
return False # has already been checked during this session
|
||||||
debug('%s?%s\n' % (depth, t))
|
debug('%s?%s\n' % (depth, t))
|
||||||
stamptime = state.stamped(t, fromdir)
|
stamptime = state.stamped(t, fromdir)
|
||||||
if stamptime == None:
|
if stamptime == None:
|
||||||
|
|
@ -29,6 +31,7 @@ def _dirty_deps(t, depth, fromdir):
|
||||||
if dirty_deps(name, depth + ' ', fromdir=vars.BASE):
|
if dirty_deps(name, depth + ' ', fromdir=vars.BASE):
|
||||||
#debug('%s-- DIRTY (sub)\n' % depth)
|
#debug('%s-- DIRTY (sub)\n' % depth)
|
||||||
return True
|
return True
|
||||||
|
state.mark(t, fromdir)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
2
redo.py
2
redo.py
|
|
@ -50,6 +50,8 @@ if is_root:
|
||||||
mkdirp('%s/.redo' % base)
|
mkdirp('%s/.redo' % base)
|
||||||
for f in glob.glob('%s/.redo/lock*' % base):
|
for f in glob.glob('%s/.redo/lock*' % base):
|
||||||
os.unlink(f)
|
os.unlink(f)
|
||||||
|
for f in glob.glob('%s/.redo/mark^*' % base):
|
||||||
|
os.unlink(f)
|
||||||
|
|
||||||
|
|
||||||
if not vars.DEPTH:
|
if not vars.DEPTH:
|
||||||
|
|
|
||||||
20
state.py
20
state.py
|
|
@ -34,6 +34,7 @@ def _stampname(t, fromdir=None):
|
||||||
|
|
||||||
|
|
||||||
def stamp(t):
|
def stamp(t):
|
||||||
|
mark(t)
|
||||||
stampfile = _stampname(t)
|
stampfile = _stampname(t)
|
||||||
newstampfile = _sname('stamp' + str(os.getpid()), t)
|
newstampfile = _sname('stamp' + str(os.getpid()), t)
|
||||||
depfile = _sname('dep', t)
|
depfile = _sname('dep', t)
|
||||||
|
|
@ -65,6 +66,25 @@ def stamped(t, fromdir=None):
|
||||||
return stamptime
|
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):
|
def is_generated(t):
|
||||||
return os.path.exists(_sname('gen', t))
|
return os.path.exists(_sname('gen', t))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue