Performance Issue
Vino.B via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Sep 5 02:44:09 PDT 2017
Hi,
The below code is consume more memory and slower can you provide
your suggestion on how to over come these issues.
string[][] csizeDirList (string FFs, int SizeDir) {
ulong subdirTotal = 0;
ulong subdirTotalGB;
auto Subdata = appender!(string[][]);
auto dFiles = dirEntries(FFs, SpanMode.shallow).filter!(a =>
a.isDir && !globMatch(a.baseName, "*DND*")).map!(a =>
tuple(a.name, a.size)).array;
foreach (d; dFiles) {
auto SdFiles = dirEntries(join(["\\\\?\\", d[0]]),
SpanMode.depth).map!(a => tuple(a.size)).array;
foreach (f; parallel(SdFiles,1))
{ subdirTotal += f[0]; }
subdirTotalGB = (subdirTotal/1024/1024);
if (subdirTotalGB > SizeDir) { Subdata ~= [d[0],
to!string(subdirTotalGB)]; }
subdirTotal = 0;
}
return Subdata.data;
}
From,
Vino.B
More information about the Digitalmars-d-learn
mailing list