AdventOfCode2021.jl
This Julia package contains my solutions for Advent of Code 2021.
Overview
Day | Problem | Time | Allocated memory | Source |
---|---|---|---|---|
1 | 229.536 μs | 280.36 KiB | ||
2 | 381.073 μs | 330.58 KiB | ||
3 | 282.606 μs | 280.73 KiB | ||
4 | 4.765 ms | 5.50 MiB | ||
5 | 1.290 ms | 2.09 MiB | ||
6 | 35.866 μs | 40.83 KiB | ||
7 | 1.536 ms | 73.33 KiB | ||
8 | 1.526 ms | 1.20 MiB | ||
9 | 3.343 ms | 2.57 MiB | ||
10 | 208.374 μs | 35.25 KiB | ||
11 | 1.267 ms | 617.28 KiB | ||
12 | 16.309 ms | 1.51 MiB | ||
13 | 1.091 ms | 1.02 MiB | ||
14 | 2.242 ms | 2.01 MiB | ||
15 | 92.165 ms | 11.78 MiB | ||
16 | 737.630 μs | 938.31 KiB | ||
17 | 1.069 ms | 364.98 KiB | ||
18 | 167.326 ms | 73.21 MiB | ||
19 | 87.311 ms | 152.01 MiB | ||
20 | 83.659 ms | 95.07 MiB | ||
21 | 10.961 ms | 4.56 MiB | ||
22 | 51.400 ms | 17.66 MiB | ||
23 | 172.330 ms | 56.06 MiB | ||
24 | 2.247 ms | 160.56 KiB | ||
25 | 32.100 ms | 49.86 MiB |
The benchmarks have been measured on this machine:
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.0 (ORCJIT, skylake)
Installation and Usage
Make sure you have Julia 1.5 or newer installed on your system.
Installation
Start Julia and enter the package REPL by typing ]
. Create a new
environment:
(@v1.5) pkg> activate aoc
Install AdventOfCode2021.jl
:
(aoc) pkg> add https://github.com/goggle/AdventOfCode2021.jl
Go back to the Julia REPL by pushing the backspace
button.
Usage
First, activate the package:
julia> using AdventOfCode2021
Each puzzle can now be run with dayXY()
:
julia> day01()
2-element Vector{Int64}:
1527
1575
This will use my personal input. If you want to use another input, provide it
to the dayXY
method as a string. You can also use the readInput
method
to read your input from a text file:
julia> input = readInput("/path/to/input.txt")
julia> AdventOfCode2021.Day01.day01(input)
2-element Vector{Int64}:
1527
1575