2
Vote

Performance of CompressDirectory(string, string) with lots of files

description

I have a directory with approx. 350,000 files in it (they're all small files, < 1KB each), and when I call SevenZipCompressor.CompressDirectory(string, string) to compress that directory, it takes an exceedingly loooong time (several hours!). I can compress the same directory with the 7-zip GUI in about 5-6 minutes.
 
Here's the code I am using:
 
        var compressor = new SevenZipCompressor();
        compressor.ArchiveFormat = OutArchiveFormat.SevenZip;
        compressor.CompressionLevel = CompressionLevel.High;
        compressor.CompressionMode = CompressionMode.Create;
        compressor.PreserveDirectoryRoot = false;
        compressor.FastCompression = true;
        compressor.CompressDirectory(dir.FullName, zipFile.FullName);
 
(dir is a DirectoryInfo and refers to the directory I want to compress, zipFile is a FileInfo and refers to the .7z file I want to create).

comments