September 07, 2017 Re: Performance Issue | ||||
---|---|---|---|---|
| ||||
Posted in reply to Azi Hassan | On Wednesday, 6 September 2017 at 18:44:26 UTC, Azi Hassan wrote:
> On Wednesday, 6 September 2017 at 18:21:44 UTC, Azi Hassan wrote:
>> I tried to create a similar file structure on my Linux machine. Here's the result of ls -R TEST1:
>>
>> TEST1:
>> BACKUP
>>...
>
> Upon further inspection it looks like I messed up the output.
>
>> [31460] - Array 1 for folder 1(all files in Folder 1) of the FS C:\\Temp\\TEST1\\BACKUP
>> [1344448] - Array 2 for folder 2(all files in Folder 2) of the FS C:\\Temp\\TEST1\\BACKUP
>> [2277663, 2277663] - Array 3 for folder 1(all files in Folder 1) of the FS C:\\Temp\\TEST2\\EXPOR
>> [31460] - Array 4 for folder 2(all files in Folder 2) the FS C:\\Temp\\TEST2\\EXPORT
>
>>What files do these sizes correspond to ? Shouldn't there be two elements in the first array because C:\Temp\TEST1\BACKUP\FOLDER1 contains two files ?
Hi Azi,
Was able to implement "fold", below is the update code, regarding container array, I have almost completed my program(Release 1), so it is not a good idea to convert the program from standard array to container array at this point. Some staring tomorrow i would be working on(Release 2) where in this release i plan to make the above changes. I have not reached my study on container array, so can you help me on how to implement the container array for the below code.
Note : I have raised another thread "Container Array" asking the same.
string[][] coSizeDirList (string FFs, int SizeDir) {
ulong subdirTotal = 0;
ulong subdirTotalGB;
auto Subdata = appender!(string[][]); Subdata.reserve(100);
auto dFiles = dirEntries(FFs, SpanMode.shallow).filter!(a => a.isDir).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.fold!((a, b) => a + b); }
subdirTotalGB = (subdirTotal/1024/1024);
if (subdirTotalGB > SizeDir) { Subdata ~= [d[0], to!string(subdirTotalGB)]; }
subdirTotal = 0;
}
return Subdata.data;
}
Note To All :
I am basically a Admin guy, so started learning D a few months ago and found it very interesting, hence i raise so many question, so request you to adjust with me for a while.
From,
Vino.B
|
Copyright © 1999-2021 by the D Language Foundation