Performance improvement: avoid recomputing signatures.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 29 Jan 2002 13:38:31 +0000 (13:38 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 29 Jan 2002 13:38:31 +0000 (13:38 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@228 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Node/FS.py
src/engine/SCons/Node/NodeTests.py
src/engine/SCons/Node/__init__.py
src/engine/SCons/Taskmaster.py
src/engine/SCons/TaskmasterTests.py

index 05c4b81c9033a6727e7aa7b999cf91e8a5a4136c..a6fc2f9af8468c8ffe77fc9d75233918c35cc116 100644 (file)
@@ -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.
index 7c19b81b412580cdcf21615689f0b055d24e925d..f28ac1f03e62afd680a6e3fa3c14b76484e55ff0 100644 (file)
@@ -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())
index 9dc2105a3ddb80e2c25abf59707e41b72fb742ea..d2b184064308735342b0681a6cd5cae8e4a32dbf 100644 (file)
@@ -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
         """
index 504c6d1fcbc16143fc7b3ad509fb46f0d0c25f5b..a992e0648a7e053ebcbfe5a673bcbc1bb6518b18 100644 (file)
@@ -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
index 7ac594b44b3db6c65f785e2134f5137a2ac60d22..b247029955a66ffa817dae3d0bb6a0a82d554901 100644 (file)
@@ -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)
index 799f8cfce6d0783ed25450d08e644d88ca654733..cc97f0d95d60d377712865f0618349d89f719201 100644 (file)
@@ -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