usr8
usr8

Reputation: 11

Issues while decompressing in-memory using SevenZipSharp library

I am decompressing .gz files in-memory using SevenZipSharp libary in c# and have encountered a strange behavior where the file size grew by 2-3 times, the decompression took significantly longer. More specifically, the avg size of .gz files are around 40MB (700-800MB when decompressed) and the decompression time was in the order of tens of seconds at most. But it took more than half an hour to decompress this specific .gz file with 90MB size (1.6GB when decompressed). Each .gz file was orginally compressed from a single txt file via 7-zip. I have attached the code:

        for (int i = 0; i < fileNames.Length; i++)
        {
            using (FileStream fs = File.OpenRead(fileNames[i]))
            {
                using (var sze = new SevenZip.SevenZipExtractor(fs))                    
                {
                    MemoryStream mem = new MemoryStream();

                    sze.ExtractFile(0, mem);

                    using (StreamReader sr = new StreamReader(mem))
                    {
                        // do something
                    }
                }
             }
         }

Any idea why the decompression time exploded here? Is this just from the overhead associated with resizing of memory stream?

Upvotes: 1

Views: 989

Answers (0)

Related Questions