summaryrefslogtreecommitdiff
path: root/2019/rust/time_all.sh
diff options
context:
space:
mode:
Diffstat (limited to '2019/rust/time_all.sh')
-rwxr-xr-x2019/rust/time_all.sh22
1 files changed, 22 insertions, 0 deletions
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