optimisation
Avoids N^2 list traversal.
This commit is contained in:
parent
08eb87fc47
commit
7ec72e3874
1 changed files with 2 additions and 2 deletions
|
@ -96,10 +96,10 @@ dirTreeRecursiveSkipping skipdir topdir = go [] [topdir]
|
||||||
go c (dir:dirs)
|
go c (dir:dirs)
|
||||||
| skipdir (takeFileName dir) = go c dirs
|
| skipdir (takeFileName dir) = go c dirs
|
||||||
| otherwise = unsafeInterleaveIO $ do
|
| otherwise = unsafeInterleaveIO $ do
|
||||||
subdirs <- go c
|
subdirs <- go []
|
||||||
=<< filterM (isDirectory <$$> getSymbolicLinkStatus)
|
=<< filterM (isDirectory <$$> getSymbolicLinkStatus)
|
||||||
=<< catchDefaultIO [] (dirContents dir)
|
=<< catchDefaultIO [] (dirContents dir)
|
||||||
go (subdirs++[dir]) dirs
|
go (subdirs++dir:c) dirs
|
||||||
|
|
||||||
{- Moves one filename to another.
|
{- Moves one filename to another.
|
||||||
- First tries a rename, but falls back to moving across devices if needed. -}
|
- First tries a rename, but falls back to moving across devices if needed. -}
|
||||||
|
|
Loading…
Reference in a new issue