From 7ec72e3874a204bd32951be1cd35af85daa7c159 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 16 May 2017 11:33:53 -0400 Subject: [PATCH] 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 693e77131e..c24f36da56 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. -}