diff options
author | cos <cos> | 2019-12-11 18:06:25 +0100 |
---|---|---|
committer | cos <cos> | 2019-12-11 18:06:25 +0100 |
commit | 0ce19fa7cd9b69ca1d49e6122d6f028740a0668c (patch) | |
tree | 70ac5aaf4321f545655bb9d4241b6461a5747494 /2019 | |
parent | 4c6c41b055d857f7dc2599262720a83da8d215be (diff) | |
download | adventofcode-0ce19fa7cd9b69ca1d49e6122d6f028740a0668c.zip |
Add execution time measurement scripts
Diffstat (limited to '2019')
-rwxr-xr-x | 2019/rust/day01/both_parts.sh | 1 | ||||
-rwxr-xr-x | 2019/rust/day02/both_parts.sh | 2 | ||||
-rwxr-xr-x | 2019/rust/day02/part_one.sh | 1 | ||||
-rwxr-xr-x | 2019/rust/day02/part_two.sh | 1 | ||||
-rwxr-xr-x | 2019/rust/day03/both_parts.sh | 1 | ||||
-rwxr-xr-x | 2019/rust/day04/both_parts.sh | 1 | ||||
-rwxr-xr-x | 2019/rust/day05/both_parts.sh | 1 | ||||
-rwxr-xr-x | 2019/rust/day06/both_parts.sh | 1 | ||||
-rwxr-xr-x | 2019/rust/day07/both_parts.sh | 2 | ||||
-rwxr-xr-x | 2019/rust/day07/calibrate_amplifiers.sh | 2 | ||||
-rwxr-xr-x | 2019/rust/day07/calibrate_amplifiers_with_feedback.sh | 12 | ||||
-rwxr-xr-x | 2019/rust/day07/part_one.sh | 1 | ||||
-rwxr-xr-x | 2019/rust/day07/part_two.sh | 1 | ||||
-rwxr-xr-x | 2019/rust/day08/both_parts.sh | 1 | ||||
-rwxr-xr-x | 2019/rust/time_all.sh | 22 |
15 files changed, 43 insertions, 7 deletions
diff --git a/2019/rust/day01/both_parts.sh b/2019/rust/day01/both_parts.sh new file mode 100755 index 0000000..ee5b2c1 --- /dev/null +++ b/2019/rust/day01/both_parts.sh @@ -0,0 +1 @@ +../target/release/day01 < input diff --git a/2019/rust/day02/both_parts.sh b/2019/rust/day02/both_parts.sh new file mode 100755 index 0000000..7a91b46 --- /dev/null +++ b/2019/rust/day02/both_parts.sh @@ -0,0 +1,2 @@ +./part_one.sh +./part_two.sh diff --git a/2019/rust/day02/part_one.sh b/2019/rust/day02/part_one.sh new file mode 100755 index 0000000..d4611db --- /dev/null +++ b/2019/rust/day02/part_one.sh @@ -0,0 +1 @@ +../target/release/day02 < input diff --git a/2019/rust/day02/part_two.sh b/2019/rust/day02/part_two.sh new file mode 100755 index 0000000..1ec6c81 --- /dev/null +++ b/2019/rust/day02/part_two.sh @@ -0,0 +1 @@ +../target/release/day02 19690720 < input diff --git a/2019/rust/day03/both_parts.sh b/2019/rust/day03/both_parts.sh new file mode 100755 index 0000000..618319b --- /dev/null +++ b/2019/rust/day03/both_parts.sh @@ -0,0 +1 @@ +../target/release/day03 < input diff --git a/2019/rust/day04/both_parts.sh b/2019/rust/day04/both_parts.sh new file mode 100755 index 0000000..0c089cc --- /dev/null +++ b/2019/rust/day04/both_parts.sh @@ -0,0 +1 @@ +../target/release/day04 `cat input` diff --git a/2019/rust/day05/both_parts.sh b/2019/rust/day05/both_parts.sh new file mode 100755 index 0000000..ddf8996 --- /dev/null +++ b/2019/rust/day05/both_parts.sh @@ -0,0 +1 @@ +../target/release/day05 < input diff --git a/2019/rust/day06/both_parts.sh b/2019/rust/day06/both_parts.sh new file mode 100755 index 0000000..2a10f5a --- /dev/null +++ b/2019/rust/day06/both_parts.sh @@ -0,0 +1 @@ +../target/release/day06 < input diff --git a/2019/rust/day07/both_parts.sh b/2019/rust/day07/both_parts.sh new file mode 100755 index 0000000..7a91b46 --- /dev/null +++ b/2019/rust/day07/both_parts.sh @@ -0,0 +1,2 @@ +./part_one.sh +./part_two.sh diff --git a/2019/rust/day07/calibrate_amplifiers.sh b/2019/rust/day07/calibrate_amplifiers.sh index 917dfa7..07dd2e1 100755 --- a/2019/rust/day07/calibrate_amplifiers.sh +++ b/2019/rust/day07/calibrate_amplifiers.sh @@ -19,7 +19,7 @@ for A in `seq 0 4`; do [ ${C} -ne ${E} ] || continue [ ${D} -ne ${E} ] || continue - O=`RUST_BACKTRACE=1 ../target/debug/day07 \ + O=`../target/release/day07 \ --mode arg --program input "${A},${I},${B},${C},${D},${E}"` V=`echo "${O}" | tail -1` [ "${H}" -ge "${V}" ] || { diff --git a/2019/rust/day07/calibrate_amplifiers_with_feedback.sh b/2019/rust/day07/calibrate_amplifiers_with_feedback.sh index 7a3a896..2506746 100755 --- a/2019/rust/day07/calibrate_amplifiers_with_feedback.sh +++ b/2019/rust/day07/calibrate_amplifiers_with_feedback.sh @@ -6,12 +6,12 @@ launch_chain() local p="input" (echo ${6}; (echo ${5}; (echo ${4}; (echo ${3}; (echo "${2} - ${1}" > "${input_file}";tail -f "${input_file}")| RUST_BACKTRACE=1 \ - ../target/debug/day07 --mode stdio --program "${p}") | \ - ../target/debug/day07 --mode stdio --program "${p}") | \ - ../target/debug/day07 --mode stdio --program "${p}") | \ - ../target/debug/day07 --mode stdio --program "${p}") | \ - ../target/debug/day07 --mode stdio --program "${p}" >> "${input_file}" + ${1}" > "${input_file}";tail -f "${input_file}")| \ + ../target/release/day07 --mode stdio --program "${p}") | \ + ../target/release/day07 --mode stdio --program "${p}") | \ + ../target/release/day07 --mode stdio --program "${p}") | \ + ../target/release/day07 --mode stdio --program "${p}") | \ + ../target/release/day07 --mode stdio --program "${p}" >> "${input_file}" tail -1 "${input_file}" } diff --git a/2019/rust/day07/part_one.sh b/2019/rust/day07/part_one.sh new file mode 100755 index 0000000..e1d0a3d --- /dev/null +++ b/2019/rust/day07/part_one.sh @@ -0,0 +1 @@ +./calibrate_amplifiers.sh diff --git a/2019/rust/day07/part_two.sh b/2019/rust/day07/part_two.sh new file mode 100755 index 0000000..b22df15 --- /dev/null +++ b/2019/rust/day07/part_two.sh @@ -0,0 +1 @@ +./calibrate_amplifiers_with_feedback.sh diff --git a/2019/rust/day08/both_parts.sh b/2019/rust/day08/both_parts.sh new file mode 100755 index 0000000..d876acb --- /dev/null +++ b/2019/rust/day08/both_parts.sh @@ -0,0 +1 @@ +../target/release/day08 < input diff --git a/2019/rust/time_all.sh b/2019/rust/time_all.sh new file mode 100755 index 0000000..4b96bae --- /dev/null +++ b/2019/rust/time_all.sh @@ -0,0 +1,22 @@ +#!/bin/zsh -e + +for DIR in day?? +do + cd "${DIR}" + cargo build --release + + for PART in ./both*part*sh + do + for I in `seq 10`; do + time "${PART}" >/dev/null + done 2> timing.txt + done + + ALL_TIMINGS="`cat timing.txt | sed 's/.* \([0-9.]*\) total/\1 +/'`" + NO_OF_TIMINGS=`echo "${ALL_TIMINGS}" | wc -l` + MEAN_TIMING=`echo $[ (${ALL_TIMINGS} 0.0005)/${NO_OF_TIMINGS} ]` + + cd .. + echo "${DIR} ${MEAN_TIMING}" + echo "${DIR} ${MEAN_TIMING}" > mean_timings.txt +done |