parallel unzip in progress

dennis luehring dl.soluz at gmx.net
Wed Apr 4 00:25:34 PDT 2012


Am 04.04.2012 08:31, schrieb Jay Norwood:
> On Tuesday, 3 April 2012 at 05:27:08 UTC, Jay Norwood wrote:
>
> ..........
> So, to answer my own questions ... I placed the code below in a
> taskpool parallel foreach loop, where each am is an archive
> member.  It is expanded,  and the expanded data is written to a
> file.  The original time info is coverted to SysTime using a
> localTime() tz timezone calculated outside the loop.  Then the
> setTimes call updates the file timestamp in Windows.  I just used
> the same system time st value for modification and access times.
>
> expand2(am);
> string destFilename = destName ~ am.name;
> std.file.write(destFilename,am.expandedData);
> SysTime st = DosFileTimeToSysTime(am.time, tz);
> std.file.setTimes(destFilename, st, st);
>
> The whole unzip, including restore of file modification times,
> completed in under 17 seconds for this 2GB expanded directory
> structure with some 39K files.  7zip took 55 seconds.
>
>
> This particular loop is currently excluding restore of times on
> directory entries, but I suppose I can restore the directory
> times after all the files have been expanded into the directory
> structure.

great idea if its ok that the directory strucutre is in an inconsistent
state on error - thats the main problem with parallel stuff - its faster 
if everything works ok - its hard to control the state if not


More information about the Digitalmars-d-learn mailing list