1

Closed

Poor memory performance when adding files

description

Garbage collection is significantly hurting performance when we zip many files at a high rate. The visual studio memory profiler says the most expensive memory allocation is occuring in the following function:
 
private static string SimplifyFwdSlashPath(string path)
{
if (path.StartsWith("./"))
{
    path = path.Substring(2);
}
path = path.Replace("/./", "/");
path = new Regex(@"^(.*/)?([^/\\.]+/\\.\\./)(.+)$").Replace(path, "$1$3");
return path;
}
 
Can this be made more efficient in its memory usage?
Closed Jul 11, 2011 at 2:04 PM by Cheeso
This is fixed either in changeset 80525 or earlier. The first release with this change will be v1.9.1.6.

comments

sbanacho wrote Apr 29, 2011 at 12:38 AM

I should mention some further data, it is the Regex constructor that is most costly. Since the regex expression is not changing, you can probably create the Regex object as a static and reuse it.

Cheeso wrote Jun 16, 2011 at 6:43 PM

Seems like a good request to me - thanks for the bug report.