Speed up Node.FS.FileFinder.find_file() by avoiding constructing debugging
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 29 Oct 2008 02:29:13 +0000 (02:29 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 29 Oct 2008 02:29:13 +0000 (02:29 +0000)
strings that will only get thrown away during normal operation.

git-svn-id: http://scons.tigris.org/svn/scons/trunk@3743 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Node/FS.py

index 4c89805cc35152c0ab416cdc54e2eb7db123397e..c0310e520810336da6c84cdbaa0c0f99066ebe28 100644 (file)
@@ -27,6 +27,8 @@ RELEASE 1.X - XXX
     - Fix a stack trace from the --debug=includes option when passed a
       static or shared library as an argument.
 
+    - Speed up the internal find_file() function (used for searching
+      CPPPATH, LIBPATH, etc.).
 
 
 RELEASE 1.1.0 - Thu, 09 Oct 2008 08:33:47 -0700
index 8301b152f75ac81622a0deb14870e00e9dc3f0b4..3268458dd4f51d17b3e882a915432d145d4720c4 100644 (file)
@@ -2967,14 +2967,11 @@ class FileFinder:
             except KeyError:
                 pass
 
-        if verbose:
+        if verbose and not callable(verbose):
             if not SCons.Util.is_String(verbose):
                 verbose = "find_file"
-            if not callable(verbose):
-                verbose = '  %s: ' % verbose
-                verbose = lambda s, v=verbose: sys.stdout.write(v + s)
-        else:
-            verbose = lambda x: x
+            verbose = '  %s: ' % verbose
+            verbose = lambda s, v=verbose: sys.stdout.write(v + s)
 
         filedir, filename = os.path.split(filename)
         if filedir:
@@ -3013,10 +3010,12 @@ class FileFinder:
 
         result = None
         for dir in paths:
-            verbose("looking for '%s' in '%s' ...\n" % (filename, dir))
+            if verbose:
+                verbose("looking for '%s' in '%s' ...\n" % (filename, dir))
             node, d = dir.srcdir_find_file(filename)
             if node:
-                verbose("... FOUND '%s' in '%s'\n" % (filename, d))
+                if verbose:
+                    verbose("... FOUND '%s' in '%s'\n" % (filename, d))
                 result = node
                 break