如何最大限度地减少在 Unix 中解压缩和压缩文件的时间?

use*_*876 4 unix performance gzip filesize zcat

我必须解压缩,然后(处理后)再次压缩(存档)源文件。文件大小很大,通常在200-250 GB左右(解压缩,.dat 格式)(总共 96 个文件)。解压缩过程大约需要 2 个小时,而压缩过程又需要 1:30 到 2 个小时,这是无法承受的。目前我正在使用“ zcat ”命令进行解压缩,并使用“ gzip -3 ”来压缩文件。磁盘空间不是问题,因为我们有 1.5 TB 的安装。请你建议做这个过程中的一些更有效的方式..

期待您的建议,谢谢 - Pushkar。

sau*_*hts 11

-q解压时尝试静音模式。如果存档中有太多文件,这将大大减少时间,因为解压缩会将名称写入标准输出。

man unzip

   -q     perform  operations  quietly  (-qq  = even quieter).  Ordinarily
          unzip prints the names of the files it's extracting or  testing,
          the extraction methods, any file or zipfile comments that may be
          stored in the archive, and possibly a summary when finished with
          each  archive.   The -q[q] options suppress the printing of some
          or all of these messages.
Run Code Online (Sandbox Code Playgroud)


Mar*_*ler 6

如果磁盘空间不是问题,那么永远不要压缩。那么你也永远不需要解压。

如果您有多个内核,您可以尝试pigz来加快速度。它是 gzip 的并行实现,可以特别加快压缩速度。

我不明白为什么与压缩相比,您的解压缩速度如此之慢。它应该快三到十倍。你能提供你在做什么的实际代码吗?那里一定有问题。

顺便说一句,你的术语是不正确的。压缩和解压缩是指 .zip 格式,而不是 .gz 格式。您只会说您压缩和解压缩 gzip 格式。

  • `pigz` 只加速压缩,不加速解压。 (2认同)