From 7ab088df8b7b9b19da872ae6504032b51b45a0bb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 8 Oct 2012 11:46:07 -0700 Subject: [PATCH 1/2] Check recurse flag before verifying path is directory Avoid an unnecessary native call if recursing into the current path has already been avoided. --- src/stdlib/fs.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stdlib/fs.coffee b/src/stdlib/fs.coffee index 839d6f0a1..33d4872b4 100644 --- a/src/stdlib/fs.coffee +++ b/src/stdlib/fs.coffee @@ -109,7 +109,7 @@ module.exports = for path in @list(rootPath) recurse = true fn(path, prune) - @traverseTree(path, fn) if @isDirectory(path) and recurse + @traverseTree(path, fn) if recurse and @isDirectory(path) lastModified: (path) -> $native.lastModified(path) From 7fc362c8016314d015c99f44fbf9c1d9cae9cefa Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 8 Oct 2012 12:09:55 -0700 Subject: [PATCH 2/2] Prune paths that are files This avoids an extra call to isDirectory for each path that has already been determined to be a file and therefore not a directory. --- src/app/project.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/project.coffee b/src/app/project.coffee index 5e7a87cac..772b4279a 100644 --- a/src/app/project.coffee +++ b/src/app/project.coffee @@ -55,6 +55,7 @@ class Project if @ignorePath(path) prune() else if fs.isFile(path) + prune() filePaths.push @relativize(path) deferred.resolve filePaths