sdset 0.1.2

Set operations for sorted and deduplicated slices. Much performances! Such Wow!
#!/usr/bin/env sh

set -x

if [ $# -eq 0 ]; then
    echo "comparing benchmarks of HEAD~1 and HEAD..."
    OLD=$(git rev-parse --short 'HEAD~1')
    NEW=$(git rev-parse --short 'HEAD')
elif [ $# -eq 1 ]; then
    echo "comparing benchmarks of $1 and HEAD..."
    OLD=$(git rev-parse --short $1)
    NEW=$(git rev-parse --short 'HEAD')
elif [ $# -eq 2 ]; then
    echo "comparing benchmarks of $1 and $2..."
    OLD=$(git rev-parse --short $1)
    NEW=$(git rev-parse --short $2)
else
    echo 'Usage: bench_script.sh [$OLD] [$NEW]'
    exit 1
fi

if ! git diff-files --quiet; then
    echo 'Your repository must not be dirty'
    exit 1
fi

if [ ! -f $NEW.bench ]; then
    git checkout $NEW
    cargo bench > $NEW.bench
    git checkout -
fi

if [ ! -f $OLD.bench ]; then
    git checkout $OLD
    cargo bench > $OLD.bench
    git checkout -
fi

cargo benchcmp --threshold 5 $OLD.bench $NEW.bench