diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-05-16 11:33:53 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-05-16 11:33:53 -0400 |
commit | cfbdd8b4612baa7ae05e1e5e6f18c3b31e2fe354 (patch) | |
tree | dd904d97db899dec42c20b2e13d0ca9969a782d3 /Utility | |
parent | fa0dee959f1a79a7b265b8f7db481c0e3b335df7 (diff) |
optimisation
Avoids N^2 list traversal.
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/Directory.hs | 4 |
1 files 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. -} |