diff options
author | Steven Knight <knight@baldmt.com> | 2005-03-05 15:50:59 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-03-05 15:50:59 (GMT) |
commit | 241b8f0c4c44d63d41698f965199bc0becfa5aea (patch) | |
tree | b79cffeaf872e0fe23c37fd6dd0b670e8e14e953 /src | |
parent | e7d8be59ff187329193589dcdf1ba3f1703c9b44 (diff) | |
download | SCons-241b8f0c4c44d63d41698f965199bc0becfa5aea.zip SCons-241b8f0c4c44d63d41698f965199bc0becfa5aea.tar.gz SCons-241b8f0c4c44d63d41698f965199bc0becfa5aea.tar.bz2 |
Reduce gen_binfo() time for very long source lists.
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/SCons/Executor.py | 15 | ||||
-rw-r--r-- | src/engine/SCons/ExecutorTests.py | 23 | ||||
-rw-r--r-- | src/engine/SCons/Node/__init__.py | 6 |
3 files changed, 31 insertions, 13 deletions
diff --git a/src/engine/SCons/Executor.py b/src/engine/SCons/Executor.py index c425a05..fb15661 100644 --- a/src/engine/SCons/Executor.py +++ b/src/engine/SCons/Executor.py @@ -187,12 +187,19 @@ class Executor: """ return filter(lambda s: s.missing(), self.sources) - def get_source_binfo(self, calc): + def get_source_binfo(self, calc, ignore=[]): """ + Return three lists, one of the source files, one of their + calculated signatures, and one of their strings (path names). __cacheable__ """ + sourcelist = self.sources + if ignore: + sourcelist = filter(lambda s, i=ignore: not s in i, sourcelist) calc_signature = lambda node, calc=calc: node.calc_signature(calc) - return map(lambda s, c=calc_signature: (s, c(s), str(s)), self.sources) + return (sourcelist, + map(calc_signature, sourcelist), + map(str, sourcelist)) @@ -219,8 +226,8 @@ class Null: pass def get_missing_sources(self): return [] - def get_source_binfo(self, calc): - return [] + def get_source_binfo(self, calc, ignore=[]): + return ([], [], []) diff --git a/src/engine/SCons/ExecutorTests.py b/src/engine/SCons/ExecutorTests.py index d3af914..d16b137 100644 --- a/src/engine/SCons/ExecutorTests.py +++ b/src/engine/SCons/ExecutorTests.py @@ -340,12 +340,25 @@ class ExecutorTestCase(unittest.TestCase): def test_get_source_binfo(self): """Test fetching the build signature info for the sources""" env = MyEnvironment() - targets = [MyNode('t')] - sources = [MyNode('s1'), MyNode('s2')] - x = SCons.Executor.Executor('b', env, [{}], targets, sources) + t1 = MyNode('t') + s1 = MyNode('s1') + s2 = MyNode('s2') + x = SCons.Executor.Executor('b', env, [{}], [t1], [s1, s2]) + b = x.get_source_binfo('C') - assert b == [(sources[0], 'cs-C-s1', 's1'), - (sources[1], 'cs-C-s2', 's2')], b + assert b == ([s1, s2], + ['cs-C-s1', 'cs-C-s2'], + ['s1', 's2']), b + + b = x.get_source_binfo('C', [s1]) + assert b == ([s2], + ['cs-C-s2'], + ['s2']), b + + b = x.get_source_binfo('C', [s2]) + assert b == ([s1], + ['cs-C-s1'], + ['s1']), b diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index 825e132..9c15659 100644 --- a/src/engine/SCons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -578,18 +578,16 @@ class Node: executor = self.get_executor() - sourcelist = executor.get_source_binfo(calc) + sourcelist, sourcesigs, bsources = executor.get_source_binfo(calc, self.ignore) depends = self.depends implicit = self.implicit or [] if self.ignore: - sourcelist = filter(lambda t, s=self: s.do_not_ignore(t[0]), sourcelist) depends = filter(self.do_not_ignore, depends) implicit = filter(self.do_not_ignore, implicit) def calc_signature(node, calc=calc): return node.calc_signature(calc) - sourcesigs = map(lambda t: t[1], sourcelist) dependsigs = map(calc_signature, depends) implicitsigs = map(calc_signature, implicit) @@ -600,7 +598,7 @@ class Node: binfo.bactsig = calc.module.signature(executor) sigs.append(binfo.bactsig) - binfo.bsources = map(lambda t: t[2], sourcelist) + binfo.bsources = bsources binfo.bdepends = map(str, depends) binfo.bimplicit = map(str, implicit) |