Git Product home page Git Product logo

aoc-2023's Introduction

Adapted from https://github.com/ChristopherBiscardi/advent-of-code

This year I've pre-set up a series of functionality for testing, benchmarking, and otherwise evaluating the performance of our Rust programs.

This includes the command just work which is passed a particular day and part and is the equivalent workflow of running all of these in a row and stopping if one fails, then re-starting the flow after changes.

cargo check
cargo nextest run
clippy-tracing --action check
cargo clippy
cargo bench
cargo flamegraph

Prepare for a new day

just create <day>

Just

Just is used to partially document all tasks, so you (the person reading this) can see what commands we were running and perhaps run them yourself on your own codebase.

I also thought it would be neat to maybe have scripts that run flamegraphs for all of the days and parts easily, so that they could be checked in and viewable on github and generally make it easier to run and document the running of various tools.

cargo-flamegraph

Flamegraphs are great for identifying what's taking up time in a program!

cargo-flamegraph will output an SVG that contains a flamegraph of the given program.

Divan

Usually I use criterion for benchmarking but this year I wanted to try out a new benchmarking tool called Divan.

I don't have a strong reason for using Divan over criterion other than to get to know the crate a bit better.

You can learn more about Divan in the announcement post.

cargo-nextest

cargo-nextest is "a next-generation test runner for Rust projects". Basically that means it includes an interesting execution model than can be great for projects with a lot of tests.

As of this year's AoC, cargo-nextest doesn't run doctests yet, so while that won't be an issue for us it is something to be aware of if you're using nextest in a "real project". (Basically that means you also run cargo test --doc).

cargo-nextest has what I consider a positive relationship with the regular cargo test and is rightfully a nice place to be experimenting with new testing UX. cargo test works well and cargo nextest is a forward-looking place for experimentation.

tracing

The tracing crate is (in my opinion) the modern standard tracing and logging infrastructure tool in the Rust ecosystem. It is maintained by the same group of people working on the tokio async runtime and is extremely widely used.

For advent of code we could get away with using println! and dbg! but tracing offers not only rich span and event tracking, but also integration with other tools like tracy.

tracy

Tracy is a profiling tool I'd like to get better at using, especially for profiling Bevy games. It is the least-known tool on this list for me.

Additional steps are needed for Tracy to work.

brew install tracy

aoc-2023's People

Contributors

nuke-web3 avatar

Watchers

 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.