folke / advent-of-code

My solutions for Advent of Code

Home Page:https://adventofcode.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status Codacy Badge Maintainability Test Coverage codecov Coverage Status snyk: vulnerabilities Greenkeeper badge Last Commit on GitHub code style: prettier

2020 Progress 2019 Progress 2018 Progress 2017 Progress 2016 Progress 2015 Progress

2020 Progress

Day Part One Part Two
TypeScript Rust TypeScript Rust
Day 1 0.37ms 3.4ms
Day 2
Day 3
Day 4
Day 5
Day 6
Day 7
Day 8
Day 9
Day 10
Day 11
Day 12
Day 13
Day 14
Day 15
Day 16
Day 17
Day 18
Day 19
Day 20
Day 21
Day 22
Day 23
Day 24
Day 25

2019 Progress

Day Part One Part Two
TypeScript Rust TypeScript Rust
Day 1 0.3ms 1.6μs* 0.39ms 3.6μs*
Day 2 0.25ms 2.2μs* 11ms 1ms*
Day 3 154ms 151ms
Day 4 62ms 77ms
Day 5 1.2ms 1.25ms
Day 6 526ms 35ms
Day 7 9.4ms 13.5ms
Day 8 2.3ms 3.26ms
Day 9 1.62ms 107ms
Day 10 61ms 64ms
Day 11 44ms 10ms
Day 12 3ms 89ms
Day 13 16ms 223ms
Day 14 22ms
Day 15
Day 16 1081ms
Day 17 42ms 110ms
Day 18
Day 19 391ms 905ms
Day 20
Day 21 23ms 168ms
Day 22 164ms 1ms
Day 23 38ms 146ms
Day 24 3ms 741ms
Day 25

2018 Progress

Day Part One Part Two
TypeScript Rust TypeScript Rust
Day 1 0.9ms 13μs 10ms 12.2μs
Day 2 9ms 9.6ms
Day 3 265ms 234ms
Day 4 6ms 4ms
Day 5 15ms 🌟 326ms
Day 6 230ms 46ms
Day 7 1ms 24ms
Day 8 6ms 🌟 6ms
Day 9 274ms 274ms
Day 10 305ms 305ms
Day 11 165ms 63007ms
Day 12 0.8ms 11ms
Day 13 17ms 51ms
Day 14 9.6ms 900ms
Day 15
Day 16
Day 17
Day 18
Day 19
Day 20
Day 21
Day 22
Day 23
Day 24
Day 25

2017 Progress

Day Part One Part Two
TypeScript Rust TypeScript Rust
Day 1 0.9ms 51μs* 0.9ms 59μs*
Day 2
Day 3
Day 4
Day 5
Day 6
Day 7
Day 8
Day 9
Day 10
Day 11
Day 12
Day 13
Day 14
Day 15
Day 16
Day 17
Day 18
Day 19
Day 20
Day 21
Day 22
Day 23
Day 24
Day 25

2016 Progress

Day Part One Part Two
TypeScript Rust TypeScript Rust
Day 1 0.37ms 0.48ms
Day 2 2.6ms 1.9ms
Day 3
Day 4
Day 5
Day 6
Day 7
Day 8
Day 9
Day 10
Day 11
Day 12
Day 13
Day 14
Day 15
Day 16
Day 17
Day 18
Day 19
Day 20
Day 21
Day 22
Day 23
Day 24
Day 25

2015 Progress

Day Part One Part Two
TypeScript Rust TypeScript Rust
Day 1 0.5ms 6.2μs* 1.2ms 1.9μs*
Day 2 2ms 194μs* 2.4ms 196μs*
Day 3 2.6ms 231μs* 2.8ms 256μs*
Day 4 663ms 506ms 19s 14s
Day 5 13ms 193μs 21ms 4ms
Day 6
Day 7
Day 8
Day 9
Day 10
Day 11
Day 12
Day 13
Day 14
Day 15
Day 16
Day 17
Day 18
Day 19
Day 20
Day 21
Day 22
Day 23
Day 24
Day 25

* measured on 8700k@4.8Ghz All benchmarks are calculated with input parsing. I plan to refactor my solutions so I can bench without it.


TypeScript

  1. Install Node.js

  2. Open with VS Code

  3. Install the suggested extensions when prompted (Recommended)

  4. Install the required packages

    npm i

    Select Current TS File launch option. F5 runs the file you're focusing in debug mode.

TypeScript Testing

There are tests on every task. You can run them with

npm test

With coverage report

npm run test:coverage

or if you installed the recommended mocha extension you can run them with that

Rust

  1. Install Rust

  2. Open with VS Code

  3. Install the suggested extensions when prompted (Recommended)

  4. Install the required crates

    cargo build

    Select Current Rust Cargo launch option. F5 runs the cargo you're focusing in debug mode. Set Rust to default to nightly

    rustup default nightly

Running individual days

cargo run -p aoc201601

Rust Testing

Run in the cargo you'd like to test

cargo test

Or in the workspace cargo if you'd like to run all tests

cargo test --all

Benchmarking

Run a specific days benchmark

cargo bench -p aoc201501

Or in the workspace cargo if you'd like to run all benchmarks (Takes a while!)

cargo bench --all

Scaffolding

cargo run -p scaffold 2016 01

Notes

All times are measured on i7-8700k@4.8Ghz 🌟 marks my favourites Right now the CodeClimate and Codecov coverage reporters only report the Node test coverage and the Coverall reporter only the Rust results. This is because for Node nyc generates lcov reports and Tarpaulin generates cobertura.xml type reports. Once either Rust gets a native coverage reporter that will output lcov or Tarpaulin supports lcov, these two reports can't be merged.

About

My solutions for Advent of Code

https://adventofcode.com/

License:MIT License


Languages

Language:TypeScript 74.4%Language:Rust 24.2%Language:Smarty 1.1%Language:JavaScript 0.3%