GithubHelp home page GithubHelp logo

nkaradzhov / advent-of-code-2021 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from timvisee/advent-of-code-2021

0.0 0.0 0.0 267 KB

๐ŸŽ„ My Advent of Code solutions in Rust. http://adventofcode.com/2021

License: GNU General Public License v3.0

Rust 100.00%

advent-of-code-2021's Introduction

Advent of Code 2021 in Rust

My Advent of Code 2021 solutions in the Rust programming language. This repository holds a separate Rust project for each day and part.

I attempt to develop a standalone, elegant, compact and fast solution for each problem (two each day).

Previous year I did the same, solving everything in under a second:

Timings

Here is how long each solution runs. All solutions are measured (non scientifically) in bench.rs on an AMD Ryzen 9 5900X (24) @ 3.7GHz machine running Linux.

part A part B
day 1 0.025ms 0.024ms
day 2 0.024ms 0.025ms
day 3 0.021ms 0.023ms
day 4 0.075ms 0.106ms
day 5 0.110ms 0.220ms
day 6 0.0027ms 0.0028ms
day 7 0.013ms 0.013ms
day 8 0.008ms 0.026ms
day 9 0.012ms 0.036ms
day 10 0.011ms 0.015ms
day 11 0.019ms 0.039ms
day 12 0.015ms 0.272ms
day 13 0.038ms 0.044ms
day 14 0.007ms 0.008ms
day 15 1.05 ms 37.7 ms
day 16 0.002ms 0.007ms
day 17 0.0002ms 0.095ms
day 18 0.141ms 2.61 ms
day 19 1.03 ms 1.03 ms
day 20 0.042ms 3.10 ms
day 21 0.0008ms 0.016ms
day 22 0.083ms 1.74 ms
one-by-one (1 CPU core) parallel
everything 50.36 ms 39.53ms

Run solutions

Each Rust project contains a input.txt file, holding the puzzle input. Simply run the project to see the solution appear.

# Switch to day 1a, and run it
cd day01a
cargo +nightly run --release

# or run everything in parallel
cd ../runner
cargo +nightly run --release --bin runner-par

# or benchmark every day
cd ../runner
cargo +nightly run --release --bin bench

Some solutions require Rust Nightly, that's why +nightly is included.

Other years

License

This project is released under the GNU GPL-3.0 license. Check out the LICENSE file for more information.

advent-of-code-2021's People

Contributors

timvisee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.