From 50343067e0a70918cb53952111cd64313360b01c Mon Sep 17 00:00:00 2001 From: stevenknight Date: Tue, 29 Jan 2002 13:38:31 +0000 Subject: [PATCH] Performance improvement: avoid recomputing signatures. git-svn-id: http://scons.tigris.org/svn/scons/trunk@228 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/CHANGES.txt | 2 ++ src/engine/SCons/Node/FS.py | 14 +------------- src/engine/SCons/Node/NodeTests.py | 6 ++++++ src/engine/SCons/Node/__init__.py | 5 +++++ src/engine/SCons/Taskmaster.py | 15 +++------------ src/engine/SCons/TaskmasterTests.py | 3 +++ 6 files changed, 20 insertions(+), 25 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 05c4b81c..a6fc2f9a 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -65,6 +65,8 @@ RELEASE 0.04 - - Add a --debug=pdb option to re-run SCons under the Python debugger. + - Only compute a build signature once for each node. + From Steve Leblanc: - Add var=value command-line arguments. diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 7c19b81b..f28ac1f0 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -501,19 +501,7 @@ class File(Entry): else: return 0 - def set_bsig(self, bsig): - """Set the build signature for this file, updating the - .sconsign entry.""" - Entry.set_bsig(self, bsig) - self.set_sconsign() - - def set_csig(self, csig): - """Set the content signature for this file, updating the - .sconsign entry.""" - Entry.set_csig(self, csig) - self.set_sconsign() - - def set_sconsign(self): + def store_sigs(self): """Update a file's .sconsign entry with its current info.""" self.dir.sconsign().set(self.name, self.get_timestamp(), self.get_bsig(), self.get_csig()) diff --git a/src/engine/SCons/Node/NodeTests.py b/src/engine/SCons/Node/NodeTests.py index 9dc2105a..d2b18406 100644 --- a/src/engine/SCons/Node/NodeTests.py +++ b/src/engine/SCons/Node/NodeTests.py @@ -257,6 +257,12 @@ class NodeTestCase(unittest.TestCase): node.set_csig('zzz') assert node.get_csig() == 'zzz' + def test_store_sigs(self): + """Test calling the method to store signatures + """ + node = SCons.Node.Node() + node.store_sigs() + def test_set_precious(self): """Test setting a Node's precious value """ diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index 504c6d1f..a992e064 100644 --- a/src/engine/SCons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -173,6 +173,11 @@ class Node: """Set the signature of the node's content.""" self.csig = csig + def store_sigs(self): + """Make the signatures permanent (that is, store them in the + .sconsign file or equivalent).""" + pass + def set_precious(self, precious = 1): """Set the Node's precious value.""" self.precious = precious diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py index 7ac594b4..b2470299 100644 --- a/src/engine/SCons/Taskmaster.py +++ b/src/engine/SCons/Taskmaster.py @@ -57,11 +57,10 @@ class Task: def __init__(self, tm, targets, top): self.tm = tm self.targets = targets - self.bsig = {} self.top = top def execute(self): - if not self.targets[0].get_state() == SCons.Node.up_to_date: + if self.targets[0].get_state() != SCons.Node.up_to_date: self.targets[0].build() def get_target(self): @@ -69,14 +68,6 @@ class Task: """ return self.targets[0] - def set_bsig(self, target, bsig): - """Set the task's (*not* the target's) build signature - for this target. - - This will be used later to update the target's actual - build signature *if* the build succeeds.""" - self.bsig[target] = bsig - def set_tstates(self, state): """Set all of the target nodes's states.""" for t in self.targets: @@ -93,7 +84,7 @@ class Task: if self.targets[0].get_state() == SCons.Node.executing: self.set_tstates(SCons.Node.executed) for t in self.targets: - t.set_bsig(self.bsig[t]) + t.store_sigs() parents = {} for p in reduce(lambda x, y: x + y.get_parents(), self.targets, []): parents[p] = 1 @@ -140,7 +131,7 @@ class Task: state = SCons.Node.up_to_date for t in self.targets: bsig = self.tm.calc.bsig(t) - self.set_bsig(t, bsig) + t.set_bsig(bsig) if not self.tm.calc.current(t, bsig): state = SCons.Node.executing self.set_tstates(state) diff --git a/src/engine/SCons/TaskmasterTests.py b/src/engine/SCons/TaskmasterTests.py index 799f8cfc..cc97f0d9 100644 --- a/src/engine/SCons/TaskmasterTests.py +++ b/src/engine/SCons/TaskmasterTests.py @@ -74,6 +74,9 @@ class Node: def set_csig(self, csig): self.csig = csig + + def store_sigs(self): + pass def children_are_executed(self): return reduce(lambda x,y: ((y.get_state() == SCons.Node.executed -- 2.26.2