AdventOfCode2021.jl icon indicating copy to clipboard operation
AdventOfCode2021.jl copied to clipboard

Advent of Code 2021 in Julia

CI Code coverage

AdventOfCode2021.jl

This Julia package contains my solutions for Advent of Code 2021.

Overview

Day Problem Time Allocated memory Source
1 :white_check_mark: 229.536 μs 280.36 KiB :white_check_mark:
2 :white_check_mark: 381.073 μs 330.58 KiB :white_check_mark:
3 :white_check_mark: 282.606 μs 280.73 KiB :white_check_mark:
4 :white_check_mark: 4.765 ms 5.50 MiB :white_check_mark:
5 :white_check_mark: 1.290 ms 2.09 MiB :white_check_mark:
6 :white_check_mark: 35.866 μs 40.83 KiB :white_check_mark:
7 :white_check_mark: 1.536 ms 73.33 KiB :white_check_mark:
8 :white_check_mark: 1.526 ms 1.20 MiB :white_check_mark:
9 :white_check_mark: 3.343 ms 2.57 MiB :white_check_mark:
10 :white_check_mark: 208.374 μs 35.25 KiB :white_check_mark:
11 :white_check_mark: 1.267 ms 617.28 KiB :white_check_mark:
12 :white_check_mark: 16.309 ms 1.51 MiB :white_check_mark:
13 :white_check_mark: 1.091 ms 1.02 MiB :white_check_mark:
14 :white_check_mark: 2.242 ms 2.01 MiB :white_check_mark:
15 :white_check_mark: 92.165 ms 11.78 MiB :white_check_mark:
16 :white_check_mark: 737.630 μs 938.31 KiB :white_check_mark:
17 :white_check_mark: 1.069 ms 364.98 KiB :white_check_mark:
18 :white_check_mark: 167.326 ms 73.21 MiB :white_check_mark:
19 :white_check_mark: 87.311 ms 152.01 MiB :white_check_mark:
20 :white_check_mark: 83.659 ms 95.07 MiB :white_check_mark:
21 :white_check_mark: 10.961 ms 4.56 MiB :white_check_mark:
22 :white_check_mark: 51.400 ms 17.66 MiB :white_check_mark:
23 :white_check_mark: 172.330 ms 56.06 MiB :white_check_mark:
24 :white_check_mark: 2.247 ms 160.56 KiB :white_check_mark:
25 :white_check_mark: 32.100 ms 49.86 MiB :white_check_mark:

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