summaryrefslogtreecommitdiff
path: root/comp_bench
blob: 01387da8415753075d315a062d8ca0cb2f4fad0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

set -e

do_bench() {
    tmpfile=$(mktemp)
    trap 'rm -f "$tmpfile"' EXIT
    compressor=cat outfile=/proc/self/fd/1 ./make | "$@" -c < initramfs.img > "$tmpfile"
    printf '%s: %s bytes\n' "$1" "$(wc -c < "$tmpfile")"
    time $1 -dc < "$tmpfile" >/dev/null
    rm "$tmpfile"
    trap '' EXIT
    echo
}

do_bench gzip -9
do_bench bzip2 -9
do_bench lzma -9e --check=crc32
do_bench xz --check=crc32 --x86 --lzma2=preset=9e
do_bench lzop -9
do_bench lz4 --best --favor-decSpeed -l