Poor memory performance when adding files


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 1: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.


sbanacho wrote Apr 28, 2011 at 11:38 PM

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.

wrote Jun 16, 2011 at 5:37 PM

Cheeso wrote Jun 16, 2011 at 5:43 PM

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

wrote Jul 11, 2011 at 1:04 PM

wrote Feb 22, 2013 at 1:43 AM

wrote May 16, 2013 at 12:31 PM