adamhathcock / sharpcompress

SharpCompress is a fully managed C# library to deal with many compression types and formats.
MIT License
2.27k stars 481 forks source link

Is there any way to improve performance of 7-Zip extract? #653

Open v2codes opened 2 years ago

v2codes commented 2 years ago

Hello, I have a performance problem described below, how can I solve this? If the 7z file without password, decompress it expend less then 1 seconds. But when set a password, it takes more then 50 seconds.

7z file info: Size: 6MB File Count: 67

Sample Code : `

        using (var archive = SevenZipArchive.Open(ppFile, new SharpCompress.Readers.ReaderOptions() { Password = key1 }))
        // using (var archive = SevenZipArchive.Open(ppFile))
        {
            archive.WriteToDirectory(ppFilePath, new ExtractionOptions()
            {
                ExtractFullPath = true,
                Overwrite = true,
                PreserveFileTime = false,
                PreserveAttributes = false
            });
        }

`

Thanks for help.

adamhathcock commented 2 years ago

Sounds like someone should take some debugging to this because you're right.

ericsia commented 2 years ago

Sorry for asking, is it necessary for second parameter to be self initialise? Because the ReaderOption options when null will initialise leaveStreamOpen as false right?

adamhathcock commented 2 years ago

Looking at the code, it won't because it if no options are supplied then one is made internally and the default option is true.

ericsia commented 2 years ago

Looking at the code, it won't because it if no options are supplied then one is made internally and the default option is true.

I have one last question. For this project do it support .net framework 3.5? Or it need framework 6 to work? I wish to test lzma2 for unzip only

adamhathcock commented 2 years ago

this is out of scope of this issue but the csproj and nuget list what targets are supported and legacy .NET Framework 3.5 isn't one of them.