No of threads

Ali Çehreli acehreli at yahoo.com
Wed Dec 20 17:31:20 UTC 2017


On 12/20/2017 05:41 AM, Vino wrote:

 > auto TL = dFiles.length;
 > auto TP = new TaskPool(TL);

I assume dFiles is large. So, that's a lot of threads there.

 > foreach (d; TP.parallel(dFiles[],1))

You tried with larger work unit sizes, right? More importantly, I think 
all these threads are working on the same disk. If the access is 
serialized by the OS or a lower entity, then all threads necessarily 
wait for each other, making the whole exercise serial.

 > auto SdFiles = Array!ulong(dirEntries(d, SpanMode.depth).map!(a =>
 > a.size).fold!((a,b) => a + b) (x))[].filter!(a => a  > Size);
 > Thread.sleep(5.seconds);

You don't need that at all. I had left it in there just to give me a 
chance to examine the number of threads the program was using.

Ali



More information about the Digitalmars-d-learn mailing list