Comparaison d’utilitaires libres de compression au format .zip
(utilisable pour fournir une WebExtension à Mozilla). Dilvulgâchis : zip est largement suffisant et bien plus rapide.
$ du --exclude .git meta-press-ext
2672 meta-press-ext (1)
1 | The size of the sample to be compressed is 2,7Mo, it contains various compressed and uncompressed .js files, pictures .png , fonts .woff2 , HTML and CSS, two vim .swp files… |
1. zip
common command from www.info-zip.org
zip
Debian-based package.
$ zip -9 -x \*.git\* -v -r `date +%F_%X`_zip meta-press-ext (1)
[…]
total bytes=2569082, compressed=922644 -> 64% savings (2)
1 | use date to set a timestamp in file name |
2 | 916ko ; time: 0,27s user 0,02s system 99% cpu 0,288 total |
2. 7z
7zip command from www.7-zip.org
p7zip
Debian-based package.
$ 7z a -tzip -mx=9 -x\!meta-press-ext/.git -x\!meta-press-ext/js/month_nb/.git `date +%F_%X`_7zip meta-press-ext
[…]
Archive size: 911448 bytes (891 KiB) (1)
1 | 892ko ; time: 6,27s user 0,02s system 351% cpu 1,792 total (6x slower for 97% of zip) |
3. zopfli
fork by Mr_KrzYch00
To install :
$ git clone --depth 1 https://github.com/MrKrzYch00/zopfli
$ cd zopfli && make zopfli
$ archive_name=`date +%F_%X`_zopfli
$ rsync -av --exclude \*.git\* meta-press-ext/ /tmp/$archive_name/ (1)
[…]
Total transferred file size: 2,569,082 bytes
[…]
$ cd /tmp && zopfli/zopfli --t`nproc` --zip --dir $archive_name (2)
[…]
Output size: 898416 (877K) (3)
[…]
1 | use rsync to select files to compress |
2 | --t for multi-threading ; this was not working, I had only one thread in every cases |
3 | 878ko ; time: 52,46s user 3,16s system 91% cpu 1:00,57 total (208x slower for 95,8% of zip) |