summaryrefslogtreecommitdiff
path: root/benchmark.bash
blob: f1f0a2cce514206143415c66e534f32b7c9f7413 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash

# Run the set of "canonical" benchmarks that are shown on
# https://nuetzlich.net/gocryptfs/comparison/

set -eu

TIME="/usr/bin/time -f %e"

# Setup
cd /tmp
wget -nv --show-progress -c https://www.kernel.org/pub/linux/kernel/v3.0/linux-3.0.tar.gz
DIR1=$(mktemp -d)
DIR2=$(mktemp -d)

if [ $# -eq 1 ] && [ "$1" == "-encfs" ]; then
	echo "Testing EncFS"
	encfs --extpass="echo test" --standard $DIR1 $DIR2 > /dev/null
else
	gocryptfs -q -init -extpass="echo test" -scryptn=10 $DIR1
	gocryptfs -q -extpass="echo test" $DIR1 $DIR2
fi
cd $DIR2

# Benchmarks
echo -n "WRITE: "
dd if=/dev/zero of=zero bs=128K count=1000 2>&1 | tail -n 1
rm zero
sleep 1
echo -n "UNTAR: "
$TIME tar xzf ../linux-3.0.tar.gz
sleep 1
echo -n "LS:    "
$TIME ls -lR linux-3.0 > /dev/null
sleep 1
echo -n "RM:    "
$TIME rm -Rf linux-3.0

# Cleanup
cd ..
fusermount -u $DIR2 -z
rm -Rf $DIR1 $DIR2