forked from mrkkrp/zip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bench.sh
executable file
·31 lines (22 loc) · 771 Bytes
/
bench.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
#
# Benchmark Haskell zip library against system zip/unzip executables:
#
# Usage: bench.hs <TEST-FILE>
set -e
SCRATCH=$(mktemp -d --tmpdir zip-bench.XXXX)
HARCHIVE=$SCRATCH/zip-bench-haskell.zip
HARCHIVE_UNPACKED=$SCRATCH/zip-bench-haskell-unpacked
SARCHIVE=$SCRATCH/zip-bench-system.zip
SARCHIVE_UNPACKED=$SCRATCH/zip-bench-system-unpacked
trap "rm -rf $SCRATCH; exit" 0 1 2 3 15
echo "Compressing."
echo "With Haskell zip library."
time haskell-zip-app compress "$1" "$HARCHIVE"
echo "With system-level zip."
time zip -9q "$SARCHIVE" "$1"
echo "Decompressing."
echo "With Haskell zip library."
time haskell-zip-app uncompress "$HARCHIVE" "$HARCHIVE_UNPACKED"
echo "With system-level zip."
time unzip -q "$SARCHIVE" -d "$SARCHIVE_UNPACKED"