Speed up SCons.Sig.Calculator.bsig() (second most time-consuming function) by 6%...
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 21 Mar 2002 07:16:35 +0000 (07:16 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 21 Mar 2002 07:16:35 +0000 (07:16 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@299 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Sig/__init__.py
src/engine/SCons/Taskmaster.py

index 7e93123e932d11fdfd87cffb5bcbc3dec2c57e7c..3770adf17cbc8e9ecb289f5ca1f231cea324d2b3 100644 (file)
@@ -204,18 +204,19 @@ class Calculator:
         # derived files, because calling get_signature() on the
         # derived nodes will in turn call bsig() again and do that
         # for us.  Hence:
-        def walk_non_derived(n, parent, myself=node):
+        sigs = []
+        def non_derived(n, parent, myself=node):
             if not n.builder or n is myself:
                 return filter(lambda x, i=myself.ignore: x not in i,
                               n.all_children(None))
             return []
-        walker = SCons.Node.Walker(node, walk_non_derived)
-        sigs = []
-        while 1:
+        def get_sig(n, parent, self=self, myself=node, sigs=sigs):
+            if not n is myself:
+                sigs.append(self.get_signature(n))
+        walker = SCons.Node.Walker(node, non_derived, eval_func=get_sig)
+        child = walker.next()
+        while child:
             child = walker.next()
-            if child is None: break
-            if child is node: continue # skip the node itself
-            sigs.append(self.get_signature(child))
 
         if node.builder:
             sigs.append(self.module.signature(node.builder_sig_adapter()))
index 404355eca1a7fdd15f15a904582a8236d6e6e210..c97d28c4a0a616a621def112c3e7700228a84a8b 100644 (file)
@@ -117,11 +117,11 @@ class Task:
         nodes = {}
         for t in self.targets:
             def get_parents(node, parent): return node.get_parents()
-            walker = SCons.Node.Walker(t, get_parents)
-            while 1:
+           def set_nodes(node, parent, nodes=nodes): nodes[node] = 1
+            walker = SCons.Node.Walker(t, get_parents, eval_func=set_nodes)
+            n = walker.next()
+            while n:
                 n = walker.next()
-                if n == None: break
-                nodes[n] = 1
         pending = filter(lambda x: x.get_state() == SCons.Node.pending,
                          nodes.keys())
         tasks = {}