Commits

Anonymous committed 7bd30ac

Various performance enhancements. (Anthony Roach)

  • Participants
  • Parent commits b2806e7

Comments (0)

Files changed (5)

 
   - Significant internal restructuring of Scanners and Taskmaster.
 
+  - Added new --debug=dtree option.
+
+  - Fixes for --profile option.
+
+  - Performance improvement in construction variable substitution.
+
 
 
 RELEASE 0.06 - Thu, 28 Mar 2002 01:24:29 -0600

src/engine/SCons/Builder.py

     the proper Builder information.
     """
     for s in slist:
-        src_key = slist[0].scanner_key()        # the file suffix
+        src_key = s.scanner_key()        # the file suffix
         scanner = env.get_scanner(src_key)
         if scanner:
             s.source_scanner = scanner
         """
         def adjustixes(files, pre, suf):
             ret = []
-            if SCons.Util.is_String(files):
-                files = string.split(files)
-            if not SCons.Util.is_List(files):
-                files = [files]
+            files = SCons.Util.argmunge(files)
+
             for f in files:
                 if SCons.Util.is_String(f):
                     if pre and f[:len(pre)] != pre:

src/engine/SCons/Node/__init__.py

           in the list are not split at spaces.
     In all cases, the function returns a list of Node instances."""
 
-    narg = arg
-    if SCons.Util.is_String(arg):
-        narg = string.split(arg)
-    elif not SCons.Util.is_List(arg):
-        narg = [arg]
+    narg = SCons.Util.argmunge(arg)
 
     nodes = []
     for v in narg:

src/engine/SCons/Util.py

     surrounded by curly braces to separate the name from
     trailing characters.
     """
+    
+    # Make the common case (i.e. nothing to do) fast:
+    if string.find(strSubst, "$") == -1 \
+       and (remove is None or remove.search(strSubst) is None):
+        return strSubst
+    
     cmd_list = scons_subst_list(strSubst, globals, locals, remove)
     return string.join(map(string.join, cmd_list), '\n')
 
 def is_List(e):
     return type(e) is types.ListType or isinstance(e, UserList.UserList)
 
+def argmunge(arg):
+    """This function converts a string or list into a list of strings or Nodes.
+    It follows the rules outlined in the SCons design document by accepting
+    any of the following inputs:
+        - A single string containing names separated by spaces. These will be
+          split apart at the spaces.
+        - A single None instance
+        - A list containing either strings or Node instances. Any strings
+          in the list are not split at spaces.
+    In all cases, the function returns a list of Nodes and strings."""
+    if is_List(arg):
+        return arg
+    elif is_String(arg):
+        return string.split(arg)
+    else:
+        return [arg]
+
 if hasattr(types, 'UnicodeType'):
     def is_String(e):
         return type(e) is types.StringType \

src/engine/SCons/UtilTests.py

         if hasattr(types, 'UnicodeType'):
             exec "assert not is_List(u'')"
 
+    def test_argmunge(self):
+        assert argmunge("foo bar") == ["foo", "bar"]
+        assert argmunge(["foo", "bar"]) == ["foo", "bar"]
+        assert argmunge("foo") == ["foo"]
+
     def test_is_String(self):
         assert is_String("")
         if hasattr(types, 'UnicodeType'):