35 lines
1.0 KiB
Markdown
35 lines
1.0 KiB
Markdown
|
# erofs compression
|
||
|
|
||
|
```bash
|
||
|
#!/bin/bash
|
||
|
set -x
|
||
|
|
||
|
# Algorithms are listed in erofs-utils:lib/compressor.c.
|
||
|
# The best level for each algorithm is listed in erofs-utils:lib/compressor_${alg}.c:.best_level.
|
||
|
choices=(
|
||
|
lz4 # doesn't take a level argument (.setlevel is NULL)
|
||
|
lz4hc,12 # /usr/include/lz4hc.h
|
||
|
lzma,109 # compressor_liblzma.c
|
||
|
deflate,9
|
||
|
libdeflate,12
|
||
|
)
|
||
|
|
||
|
time zstd mario.img # creates mario.img.zst
|
||
|
|
||
|
mkdir mnt
|
||
|
sudo mount -o loop mario.img mnt
|
||
|
for choice in "${choices[@]}"; do
|
||
|
time sudo mkfs.erofs -z"${choice}" mario-"${choice/,/-}.img" mnt
|
||
|
done
|
||
|
```
|
||
|
|
||
|
| 1.6G | mario.img | 1m7s | Non-compressed
|
||
|
|------+-------------------------+--------|
|
||
|
| 904M | mario.img.zst | 4s | For comparison
|
||
|
|------+-------------------------+--------|
|
||
|
| 1.2G | mario-lz4.img | 53s |
|
||
|
| 1.1G | mario-lz4hc-12.img | 2m18s |
|
||
|
| 957M | mario-lzma-109.img | 10m17s |
|
||
|
| 997M | mario-deflate-9.img | 2m25s |
|
||
|
| 0 | mario-libdeflate-12.img | - | (compiled without libdeflate support)
|