summaryrefslogtreecommitdiff
path: root/bench
blob: e6a710d3738b39ce56d3e088f0d065b9dd64ceba (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
#!/usr/bin/env zsh

year=$1
day=$2
lang=$3
input=$4
warmups=${5:=0}

script=$(readlink -f "$0")
script_path=$(dirname "$script")

aoc_path=$script_path/$1/$2
data_path="$aoc_path/data/$4.txt"

# Check it is correct
$script_path/check $1 $2 $3 $4 > /dev/null
[[ ! $? ]] && echo "Incorrect solution" && exit 1


if [[ $lang == "python" ]]; then
    exec="python $aoc_path/python/main.py"
elif [[ $lang == "rust" ]]; then
    # Compile first
    cargo build --release --target-dir /tmp/aoc_rust --manifest-path $aoc_path/rust/Cargo.toml
    exec="/tmp/aoc_rust/release/aoc_$year-$day"
else
    echo "Unknown lang: $lang"
    exit 1
fi

hyperfine --shell=none --warmup=$warmups --input=$data_path $exec