From cfbdd8b4612baa7ae05e1e5e6f18c3b31e2fe354 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 16 May 2017 11:33:53 -0400 Subject: optimisation Avoids N^2 list traversal. --- Utility/Directory.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Utility/Directory.hs b/Utility/Directory.hs index 693e77131..c24f36da5 100644 --- a/Utility/Directory.hs +++ b/Utility/Directory.hs @@ -96,10 +96,10 @@ dirTreeRecursiveSkipping skipdir topdir = go [] [topdir] go c (dir:dirs) | skipdir (takeFileName dir) = go c dirs | otherwise = unsafeInterleaveIO $ do - subdirs <- go c + subdirs <- go [] =<< filterM (isDirectory <$$> getSymbolicLinkStatus) =<< catchDefaultIO [] (dirContents dir) - go (subdirs++[dir]) dirs + go (subdirs++dir:c) dirs {- Moves one filename to another. - First tries a rename, but falls back to moving across devices if needed. -} -- cgit v1.2.3