prune with dirEntries

Joshua Niehus jm.niehus at gmail.com
Fri Nov 30 08:36:44 PST 2012


On Friday, 30 November 2012 at 12:02:51 UTC, Dan wrote:
> Good idea, thanks. I could not get original to compile as is - 
> but the concept is just what was needed. I got an error on line 
> 8:
> Error: not a property dirEntries(path, cast(SpanMode)0, 
> true).filter!(__lambda2)
> I'm using a quite recent version of dmd and phobos.

hmm strange... I'm using 2.060 (on a mac),

> But, I pulled the lamda out into a function and it works great. 
> I assume the parallel is for performance, and it actually runs 
> significantly slower than without on my test case - but no work 
> is being done other than build the list of files, so that is 
> probably normal. For my case the breakdown is:
>
> No Pruning: 11 sec
> Pruning Parallel: 4.78 sec
> Pruning Serial: 0.377 sec

Thats cool.
Yea I thought parallel would make a big difference (in the 
positive sense) for large directories, but I guess if we are 
recursively spawning parallel tasks, the overhead involved starts 
accumulating, resulting in worse performance (my best guess 
anyway).




More information about the Digitalmars-d-learn mailing list