| 1 | bzip2, gzip, or zip. Which will win the race? |
| 2 | |
| 3 | = File characteristic = |
| 4 | quick# ls -alh embedded.img |
| 5 | > -rw-r--r-- 1 root wheel 1.0G Nov 4 16:55 embedded.img |
| 6 | |
| 7 | quick# mdconfig -a -t vnode -f embedded.img |
| 8 | > md0 |
| 9 | quick# mount /dev/md0 |
| 10 | > md0% md0s1% md0s1a% |
| 11 | quick# mount /dev/md0s1a /mnt/ |
| 12 | quick# df -h | grep mnt |
| 13 | > /dev/md0s1a 961M 189M 695M 21% /mnt |
| 14 | |
| 15 | = Experiments = |
| 16 | |
| 17 | quick# time zip embedded.img.zip embedded.img |
| 18 | > adding: embedded.img |
| 19 | > 31.350u 0.706s 0:32.23 99.4% 223+1310k 4+604io 0pf+0w |
| 20 | quick# time gzip embedded.img |
| 21 | > 36.136u 0.781s 0:37.13 99.4% 42+1491k 2+604io 0pf+0w |
| 22 | quick# time bzip2 embedded.img |
| 23 | > 91.701u 0.961s 1:32.83 99.8% 37+1496k 1+533io 0pf+0w |
| 24 | |
| 25 | quick# ls -lah embedded.img.* |
| 26 | > -rw-r--r-- 1 root wheel 67M Nov 4 16:55 embedded.img.bz2 |
| 27 | > -rw-r--r-- 1 root wheel 75M Nov 4 16:55 embedded.img.gz |
| 28 | > -rw-r--r-- 1 root wheel 76M Nov 4 16:58 embedded.img.zip |
| 29 | |
| 30 | quick# time unzip embedded.img.zip |
| 31 | > Archive: embedded.img.zip |
| 32 | > inflating: embedded.img |
| 33 | > 8.175u 1.237s 0:18.30 51.3% 145+1354k 0+8000io 0pf+0w |
| 34 | quick# time gunzip embedded.img.gz |
| 35 | > 6.076u 1.380s 0:17.98 41.4% 42+1500k 0+8000io 0pf+0w |
| 36 | quick# time bunzip2 embedded.img.bz2 |
| 37 | > 20.996u 1.935s 0:31.99 71.6% 37+1487k 0+8000io 0pf+0w |
| 38 | |
| 39 | |
| 40 | = Results = |
| 41 | Use bzip2 for best compression, but trade off is time (roughly 2x more), still do-able though. Also do mind that zip is the only one support by Windows(r) by default. Others require programs like 7-Zip to be installed. Secondly zip is not installed on the system by default, use: |
| 42 | quick# pkg_add -r zip unzip |