From d23f87b2b9703c0adc0c544ef204c2851d1caafc Mon Sep 17 00:00:00 2001 From: stevenknight Date: Wed, 29 Oct 2008 02:29:13 +0000 Subject: [PATCH] Speed up Node.FS.FileFinder.find_file() by avoiding constructing debugging 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 | 2 ++ src/engine/SCons/Node/FS.py | 15 +++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 4c89805c..c0310e52 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -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 diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 8301b152..3268458d 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -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 -- 2.26.2