Skip to content

Commit cf585fc

Browse files
committed
adds timing to each days file
1 parent d9a713d commit cf585fc

25 files changed

+148
-1
lines changed

day_01.Rmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
knitr::opts_chunk$set(echo = TRUE)
55
options(crayon.enabled = NULL)
66
library(tidyverse)
7+
8+
START_TIME <- Sys.time()
79
```
810

911
This is my attempt to solve [Day 1](https://adventofcode.com/2020/day/1).
@@ -247,3 +249,7 @@ def part_2_py(input_values, target):
247249
bench::mark(part_2_improved(actual, 2020),
248250
py$part_2_py(actual, 2020))
249251
```
252+
253+
---
254+
255+
*Elapsed Time: `r round(Sys.time() - START_TIME, 3)`s*

day_02.Rmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
knitr::opts_chunk$set(echo = TRUE)
55
options(crayon.enabled = NULL)
66
library(tidyverse)
7+
8+
START_TIME <- Sys.time()
79
```
810

911
This is my attempt to solve [Day 2](https://adventofcode.com/2020/day/2).
@@ -126,3 +128,7 @@ This matches the example, so we can now solve part 2.
126128
```{r part 2 solution}
127129
length(part_2_valid_passwords(actual))
128130
```
131+
132+
---
133+
134+
*Elapsed Time: `r round(Sys.time() - START_TIME, 3)`s*

day_03.Rmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
knitr::opts_chunk$set(echo = TRUE)
55
options(crayon.enabled = NULL)
66
library(tidyverse)
7+
8+
START_TIME <- Sys.time()
79
```
810

911
This is my attempt to solve [Day 3](https://adventofcode.com/2020/day/3).
@@ -149,3 +151,7 @@ The other combinations would be going just 1 down at each step, and then all of
149151
that the greatest common divisor of right and down is 1. This would give us all of the movements that don't violate the
150152
constraint above of a non-unique movement. For instance, 6 right, 2 down has a greatest common divisor of 2, and this
151153
combination is the same as 3 right, 1 down.
154+
155+
---
156+
157+
*Elapsed Time: `r round(Sys.time() - START_TIME, 3)`s*

day_04.Rmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
knitr::opts_chunk$set(echo = TRUE)
55
options(crayon.enabled = NULL)
66
library(tidyverse)
7+
8+
START_TIME <- Sys.time()
79
```
810

911
This is my attempt to solve [Day 4](https://adventofcode.com/2020/day/4).
@@ -191,3 +193,7 @@ actual %>%
191193
map_lgl(compose(all, flatten_lgl)) %>%
192194
sum()
193195
```
196+
197+
---
198+
199+
*Elapsed Time: `r round(Sys.time() - START_TIME, 3)`s*

day_05.Rmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
knitr::opts_chunk$set(echo = TRUE)
55
options(crayon.enabled = NULL)
66
library(tidyverse)
7+
8+
START_TIME <- Sys.time()
79
```
810

911
This is my attempt to solve [Day 5](https://adventofcode.com/2020/day/5).
@@ -110,3 +112,7 @@ triangle_number <- function(n) 0.5 * n * (n + 1)
110112
111113
triangle_number(max(seats)) - triangle_number(min(seats) - 1) - sum(seats)
112114
```
115+
116+
---
117+
118+
*Elapsed Time: `r round(Sys.time() - START_TIME, 3)`s*

day_06.Rmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
knitr::opts_chunk$set(echo = TRUE)
55
options(crayon.enabled = NULL)
66
library(tidyverse)
7+
8+
START_TIME <- Sys.time()
79
```
810

911
This is my attempt to solve [Day 6](https://adventofcode.com/2020/day/6).
@@ -112,3 +114,7 @@ We can now check that this new function works as expected:
112114
extra(actual, union) == part_1(actual)
113115
extra(actual, intersect) == part_2(actual)
114116
```
117+
118+
---
119+
120+
*Elapsed Time: `r round(Sys.time() - START_TIME, 3)`s*

day_07.Rmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ library(tidyverse)
77
library(igraph)
88
library(ggraph)
99
library(unglue)
10+
11+
START_TIME <- Sys.time()
1012
```
1113

1214
This is my attempt to solve [Day 7](https://adventofcode.com/2020/day/7).
@@ -154,3 +156,7 @@ part_2_alt(sample_g, "shiny gold", 1) - 1 == part_2(sample_g)
154156
```{r extra part 2 alt actual test}
155157
part_2_alt(actual_g, "shiny gold", 1) - 1 == part_2(actual_g)
156158
```
159+
160+
---
161+
162+
*Elapsed Time: `r round(Sys.time() - START_TIME, 3)`s*

day_08.Rmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ options(crayon.enabled = NULL)
66
library(tidyverse)
77
library(R6)
88
library(unglue)
9+
10+
START_TIME <- Sys.time()
911
```
1012

1113
This is my attempt to solve [Day 8](https://adventofcode.com/2020/day/8).
@@ -321,3 +323,7 @@ Computer <- R6Class(
321323
)
322324
)
323325
```
326+
327+
---
328+
329+
*Elapsed Time: `r round(Sys.time() - START_TIME, 3)`s*

day_09.Rmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
knitr::opts_chunk$set(echo = TRUE)
55
options(crayon.enabled = NULL)
66
library(tidyverse)
7+
8+
START_TIME <- Sys.time()
79
```
810

911
This is my attempt to solve [Day 9](https://adventofcode.com/2020/day/9).
@@ -89,3 +91,7 @@ And run on the actual input:
8991
```{r part 2 sample actual}
9092
part_2(actual, pa1)
9193
```
94+
95+
---
96+
97+
*Elapsed Time: `r round(Sys.time() - START_TIME, 3)`s*

day_10.Rmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
knitr::opts_chunk$set(echo = TRUE)
55
options(crayon.enabled = NULL)
66
library(tidyverse)
7+
8+
START_TIME <- Sys.time()
79
```
810

911
This is my attempt to solve [Day 10](https://adventofcode.com/2020/day/10).
@@ -86,3 +88,7 @@ notation by setting the `scipen` option.
8688
options(scipen = 999)
8789
part_2(actual)
8890
```
91+
92+
---
93+
94+
*Elapsed Time: `r round(Sys.time() - START_TIME, 3)`s*

0 commit comments

Comments
 (0)