本文介绍了估计 zip 大小/创建时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用 Python zipfile 模块或 unix 命令行实用程序按需创建 ZIP 档案.

I need to create ZIP archives on demand, using either Python zipfile module or unix command line utilities.

要压缩的资源通常 > 1GB,并且不一定适合压缩.

Resources to be zipped are often > 1GB and not necessarily compression-friendly.

如何有效地估计其创建时间/大小?

How do I efficiently estimate its creation time / size?

推荐答案

从大文件中提取一堆小部件.可能有 64 个 64k 的块.随机选择.

Extract a bunch of small parts from the big file. Maybe 64 chunks of 64k each. Randomly selected.

连接数据,压缩它,测量时间和压缩率.由于您随机选择了文件的一部分,因此您可能压缩了数据的代表性子集.

Concatenate the data, compress it, measure the time and the compression ratio. Since you've randomly selected parts of the file chances are that you have compressed a representative subset of the data.

现在您要做的就是根据测试数据的时间估计整个文件的时间.

Now all you have to do is to estimate the time for the whole file based on the time of your test-data.

这篇关于估计 zip 大小/创建时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 15:47