optimisation

Avoids N^2 list traversal.
This commit is contained in:
Joey Hess 2017-05-16 11:33:53 -04:00
parent 08eb87fc47
commit 7ec72e3874
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -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. -}