folke / adventofcode

🎅 🎄 ⛄ ✨ Solutions for Advent of Code 2020 in TypeScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Advent of Code 2020 🎅 🎄

Advent of Code using TypeScript.

There's no need to build anything. Source files are transpiled and cached on-the-fly using esbuild-runner with pretty much zero overhead. Running the code for a certain day, will:

  • download the input if needed
  • test any examples for each part
  • test the answer (if availble) for each part
  • measure the performance and update the benchmark section of this readme

Benchmark

My personal goal for this year is to solve all puzzles within 25ms total, so an average of 1ms per puzzle.

edit: never mind 😂

❄️ 2020

2020 Part1 Part2 Total Days Total Stars
Day 1 12µs 196µs ⚡️ 208µs 208µs
Day 2 320µs 175µs ⚡️ 496µs 703µs
Day 3 3µs 15µs ⚡️ 18µs 721µs
Day 4 302µs 429µs ⚡️ 730µs 1.45ms
Day 5 362µs 356µs ⚡️ 718µs 2.17ms
Day 6 131µs 143µs ⚡️ 274µs 2.44ms
Day 7 573µs 392µs ⚡️ 965µs 3.41ms
Day 8 100µs 144µs ⚡️ 244µs 3.65ms
Day 9 93µs 47µs ⚡️ 141µs 3.79ms
Day 10 14µs 23µs ⚡️ 37µs 3.83ms
Day 11 32.43ms 55.86ms ❗️ 88.29ms 92.12ms
Day 12 23µs 26µs ⚡️ 50µs 92.17ms
Day 13 4µs 19µs ⚡️ 23µs 92.19ms
Day 14 632µs 6.97ms ❗️ 7.6ms 99.79ms
Day 15 10µs 683.67ms ❗️ 683.67ms 783.47ms
Day 16 554µs 1.26ms ❗️ 1.81ms 785.28ms
Day 17 41.86ms 1359.56ms ❗️ 1401.42ms 2186.7ms
Day 18 1.91ms 1.91ms ❗️ 3.82ms 2190.52ms
Day 19 425µs 667µs ❗️ 1.09ms 2191.61ms

❄️ 2019

2019 Part1 Part2 Total Days Total Stars
Day 1 3µs 10µs ⚡️ 13µs 13µs
Day 3 58.98ms 114.56ms ❗️ 173.54ms 173.55ms
Day 4 6.66ms 6.29ms ❗️ 12.95ms 186.5ms

❄️ 2015

2015 Part1 Part2 Total Days Total Stars
Day 1 85µs 9µs ⚡️ 95µs 95µs
Day 2 611µs 785µs ❗️ 1.4ms 1.49ms
Day 3 263µs 282µs ⚡️ 545µs 2.04ms
Day 4 592.43ms 18805.74ms ❗️ 19398.16ms 19400.2ms
Day 5 394µs 703µs ❗️ 1.1ms 19401.3ms

🚀 Usage

$ bin/aoc --help
Usage: aoc [options] [day]

  --year [year] Defaults to 2020       
  --bench       Benchmark the solutions for all days
  --help|-h     Display this help message

To run all days:

$ bin/aoc

To run a specific day:

$ bin/aoc 3

To run the benchmarks:

$ bin/aoc --bench

if a day has not been implemented yet, executing that day will create a new src/day??.ts file based on the template

About

🎅 🎄 ⛄ ✨ Solutions for Advent of Code 2020 in TypeScript

License:Apache License 2.0


Languages

Language:TypeScript 93.6%Language:JavaScript 6.1%Language:Smarty 0.4%