rubenjr0 / Advent-Of-Code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Advent Of Code

In this repo I'll update my solutions to the yearly challenge of Advent Of Code by Eric Wastl.

Languages

Python

I chose Python because it's flexibility allows me to try different aproaches quickly. It's is my go-to language when I've to prototype and iterate.

Crystal

Crystal is almost as easy to write as Python and runs almost as fast as C. It may be a young language but it's a lot of fun to write!

Julia

Julia is a really powerful language. It may not have Python's scripting features but in my opinion it's a much better option for anything computationally intensive.

Rust

Rust is amazing. I refuse to elaborate.

Project Structure

The solutions will be separated by year and day. The input will be placed next to the sources and binaries will be placed in a build folder. Both the input and the binaries will be git-ignored.

Example:

  • 2020
    • day-1
      • build
        • rust
        • crystal
      • python.py
      • rust.rs
      • crystal.cr
      • input
    • day-2
      • build
        • rust
      • python.py
      • rust.rs
      • julia.jl
      • input
  • 2021
    • day-1

Benchmarks

I like to benchmark my solutions with sharkdp's Hyperfine. Here's an example of what it looks like:

hyperfine --warmup 10 -m 1500 'python3.9 python.py' './build/crystal' './build/rust' --export-markdown build/day-2-report.md
Command Mean [ms] Min [ms] Max [ms] Relative
python3.9 python.py 16.3 ± 3.8 9.5 22.0 19.37 ± 9.18
./build/crystal 1.2 ± 0.1 0.9 2.1 1.38 ± 0.58
./build/rust 0.8 ± 0.3 0.3 4.1 1.00

About


Languages

Language:Rust 66.2%Language:Python 20.2%Language:Crystal 7.3%Language:Julia 6.1%Language:Haskell 0.3%