summaryrefslogtreecommitdiff
path: root/2019
diff options
context:
space:
mode:
Diffstat (limited to '2019')
-rwxr-xr-x2019/rust/day01/both_parts.sh2
-rwxr-xr-x2019/rust/day02/part_one.sh2
-rwxr-xr-x2019/rust/day02/part_two.sh2
-rwxr-xr-x2019/rust/day03/both_parts.sh2
-rwxr-xr-x2019/rust/day04/both_parts.sh2
-rwxr-xr-x2019/rust/day05/both_parts.sh2
-rwxr-xr-x2019/rust/day06/both_parts.sh2
-rwxr-xr-x2019/rust/day08/both_parts.sh2
-rwxr-xr-x2019/rust/day09/both_parts.sh5
-rwxr-xr-x2019/rust/day09/part_one.sh1
-rwxr-xr-x2019/rust/day09/part_two.sh1
-rwxr-xr-x2019/rust/day10/both_parts.sh2
-rwxr-xr-x2019/rust/day11/both_parts.sh5
-rwxr-xr-x2019/rust/day11/part_one.sh1
-rwxr-xr-x2019/rust/day11/part_two.sh1
-rwxr-xr-x2019/rust/day12/both_parts.sh2
-rwxr-xr-x2019/rust/mem-measure_most.sh28
17 files changed, 46 insertions, 16 deletions
diff --git a/2019/rust/day01/both_parts.sh b/2019/rust/day01/both_parts.sh
index ee5b2c1..4676e3f 100755
--- a/2019/rust/day01/both_parts.sh
+++ b/2019/rust/day01/both_parts.sh
@@ -1 +1 @@
-../target/release/day01 < input
+$VG ../target/release/day01 < input
diff --git a/2019/rust/day02/part_one.sh b/2019/rust/day02/part_one.sh
index d4611db..546e79c 100755
--- a/2019/rust/day02/part_one.sh
+++ b/2019/rust/day02/part_one.sh
@@ -1 +1 @@
-../target/release/day02 < input
+$VG ../target/release/day02 < input
diff --git a/2019/rust/day02/part_two.sh b/2019/rust/day02/part_two.sh
index 1ec6c81..f95053b 100755
--- a/2019/rust/day02/part_two.sh
+++ b/2019/rust/day02/part_two.sh
@@ -1 +1 @@
-../target/release/day02 19690720 < input
+$VG ../target/release/day02 19690720 < input
diff --git a/2019/rust/day03/both_parts.sh b/2019/rust/day03/both_parts.sh
index 618319b..e3d4cd6 100755
--- a/2019/rust/day03/both_parts.sh
+++ b/2019/rust/day03/both_parts.sh
@@ -1 +1 @@
-../target/release/day03 < input
+$VG ../target/release/day03 < input
diff --git a/2019/rust/day04/both_parts.sh b/2019/rust/day04/both_parts.sh
index 0c089cc..a60f969 100755
--- a/2019/rust/day04/both_parts.sh
+++ b/2019/rust/day04/both_parts.sh
@@ -1 +1 @@
-../target/release/day04 `cat input`
+$VG ../target/release/day04 `cat input`
diff --git a/2019/rust/day05/both_parts.sh b/2019/rust/day05/both_parts.sh
index ddf8996..1f7d414 100755
--- a/2019/rust/day05/both_parts.sh
+++ b/2019/rust/day05/both_parts.sh
@@ -1 +1 @@
-../target/release/day05 < input
+$VG ../target/release/day05 < input
diff --git a/2019/rust/day06/both_parts.sh b/2019/rust/day06/both_parts.sh
index 2a10f5a..d43ed71 100755
--- a/2019/rust/day06/both_parts.sh
+++ b/2019/rust/day06/both_parts.sh
@@ -1 +1 @@
-../target/release/day06 < input
+$VG ../target/release/day06 < input
diff --git a/2019/rust/day08/both_parts.sh b/2019/rust/day08/both_parts.sh
index d876acb..6549f9e 100755
--- a/2019/rust/day08/both_parts.sh
+++ b/2019/rust/day08/both_parts.sh
@@ -1 +1 @@
-../target/release/day08 < input
+$VG ../target/release/day08 < input
diff --git a/2019/rust/day09/both_parts.sh b/2019/rust/day09/both_parts.sh
index fb654a1..7a91b46 100755
--- a/2019/rust/day09/both_parts.sh
+++ b/2019/rust/day09/both_parts.sh
@@ -1,3 +1,2 @@
-echo 1|../target/release/day09 --mode stdio --program input
-echo 2|../target/release/day09 --mode stdio --program input
-
+./part_one.sh
+./part_two.sh
diff --git a/2019/rust/day09/part_one.sh b/2019/rust/day09/part_one.sh
new file mode 100755
index 0000000..f3e3ef9
--- /dev/null
+++ b/2019/rust/day09/part_one.sh
@@ -0,0 +1 @@
+echo 1|$VG ../target/release/day09 --mode stdio --program input
diff --git a/2019/rust/day09/part_two.sh b/2019/rust/day09/part_two.sh
new file mode 100755
index 0000000..3bf7fce
--- /dev/null
+++ b/2019/rust/day09/part_two.sh
@@ -0,0 +1 @@
+echo 2|$VG ../target/release/day09 --mode stdio --program input
diff --git a/2019/rust/day10/both_parts.sh b/2019/rust/day10/both_parts.sh
index 68b03ce..fc8264d 100755
--- a/2019/rust/day10/both_parts.sh
+++ b/2019/rust/day10/both_parts.sh
@@ -1,2 +1,2 @@
-../target/release/day10 < input
+$VG ../target/release/day10 < input
diff --git a/2019/rust/day11/both_parts.sh b/2019/rust/day11/both_parts.sh
index c9ed7ef..7a91b46 100755
--- a/2019/rust/day11/both_parts.sh
+++ b/2019/rust/day11/both_parts.sh
@@ -1,3 +1,2 @@
-../target/release/day11 --program input
-../target/release/day11 --program input --use-emergency-panel
-
+./part_one.sh
+./part_two.sh
diff --git a/2019/rust/day11/part_one.sh b/2019/rust/day11/part_one.sh
new file mode 100755
index 0000000..aa9e8c0
--- /dev/null
+++ b/2019/rust/day11/part_one.sh
@@ -0,0 +1 @@
+$VG ../target/release/day11 --program input
diff --git a/2019/rust/day11/part_two.sh b/2019/rust/day11/part_two.sh
new file mode 100755
index 0000000..8136475
--- /dev/null
+++ b/2019/rust/day11/part_two.sh
@@ -0,0 +1 @@
+$VG ../target/release/day11 --program input --use-emergency-panel
diff --git a/2019/rust/day12/both_parts.sh b/2019/rust/day12/both_parts.sh
index 853e985..49bb4b4 100755
--- a/2019/rust/day12/both_parts.sh
+++ b/2019/rust/day12/both_parts.sh
@@ -1,2 +1,2 @@
-../target/release/day12 < input
+$VG ../target/release/day12 < input 1000
diff --git a/2019/rust/mem-measure_most.sh b/2019/rust/mem-measure_most.sh
new file mode 100755
index 0000000..b7dd4a2
--- /dev/null
+++ b/2019/rust/mem-measure_most.sh
@@ -0,0 +1,28 @@
+#!/bin/zsh -e
+
+for DIR in day*
+do
+ cd "${DIR}"
+ cargo build --release
+
+ if [ -e part_one.sh ]; then
+ PARTS="part_one.sh part_two.sh"
+ else
+ PARTS="both_parts.sh"
+ fi
+
+ # https://stackoverflow.com/q/774556/peak-memory-usage-of-a--process
+ for PART in `echo ${PARTS}`
+ do
+ OUT="${PART%*.sh}"
+ OUT="${OUT#*_}.txt"
+ VG="valgrind --tool=massif --pages-as-heap=yes \
+ --massif-out-file=massif.out" \
+ ./${PART}; grep mem_heap_B massif.out | \
+ sed -e 's/mem_heap_B=\(.*\)/\1/' | sort -g | tail -n 1 \
+ > "memmax-${OUT}"
+ MEM=`cat "memmax-${OUT}"`
+ echo ${DIR} MEM: ${MEM} $[ MEM / 1024. ]k $[ MEM /1024./1024 ]M
+ done
+ cd ..
+done