提取.zip存档的最快方法 [英] fastest way to extract .zip archive

查看:102
本文介绍了提取.zip存档的最快方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪种方法是提取.zip归档文件最快的方法?我的应用程序的性能高度取决于.zip文件的提取速度.我正在使用dotNetzip atm,但似乎可能会有更快的工具.如果有,他们安全吗?我听说QuickLZ是最快的,但尚未对其进行测试,也未找到任何代码示例或如何在c#中使用它.任何帮助将不胜感激.

Which is the fastest way for extracting .zip archives? Performance of my application is highly based on how fast .zip files are extracted. I am using dotNetzip atm, but it seems that there could be more faster tools. If there is, are they safe? I've heard that QuickLZ is the fastest, but haven't tested it, also haven't found any code samples or how to use it in c#. Any help would be greatly appriciated.

推荐答案

进行我们自己的测试,到目前为止,7-zip CLI(exe文件)是最快的. CLI应用程序的性能胜过所有这些.NET dll,这听起来很疯狂,但不幸的是,事实就是如此.

Doing our own tests, 7-zip CLI (exe file) was fastest by far. It sounds crazy that a CLI application would outperform all those .NET dlls, but unfortunately it's the fact.

准确地说,我已经使用ZipFile和ZipArchive测试了SharpCompress,SharpZipLib,DotNetZip和.NET自己的实现.对于我们的测试文件,所有这些文件的运行时间大约都是10-20秒,但是7-zip的exe进程通常会在7-8秒时完成.

To be precise, I've tested SharpCompress, SharpZipLib, DotNetZip, .NET's own implementation using ZipFile and ZipArchive. All of them were running around 10-20 seconds for our test file, but 7-zip's exe process was usually finishing at 7-8 seconds.

如果您决定使用7-zip,这是示例代码:

Here is a sample code, if you decide to use 7-zip:

    private static void ExtractWith7Zip(string archivePath, string extractPath)
    {
        var info = new ProcessStartInfo
        {
            FileName = @"C:\Program Files\7-Zip\7z.exe",
            Arguments = $"x -y -o\"{extractPath}\" \"{archivePath}\"",
            WindowStyle = ProcessWindowStyle.Hidden,
            CreateNoWindow = true,
            UseShellExecute = false,
            RedirectStandardOutput = true
        };

        Process.Start(info)?.WaitForExit();
    }

这篇关于提取.zip存档的最快方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆