The spiritual little brother of
less_slow.cpp
. The benchmarks in this repository don't aim to cover every topic entirely, but they help form a mindset and intuition for performance-oriented software design.
Much of modern code suffers from common pitfalls: bugs, security vulnerabilities, and performance bottlenecks. University curricula often teach outdated concepts, while bootcamps oversimplify crucial software development principles.
This repository offers practical examples of writing efficient Rust code. The topics range from basic micro-kernels executing in a few nanoseconds to more complex constructs involving parallel algorithms, coroutines, and polymorphism. Some of the highlights include:
- Experimental coroutines can be 3x faster than
async-stream
. - Discouraged "internal" math intrinsics can yield a 5x speedup.
To read, jump to the less_slow.rs
source file and read the code snippets and comments.
If you are familiar with Rust and want to review code and measurements as you read, you can clone the repository and execute the following commands.
rustup install nightly-2025-01-11
cargo +nightly-2025-01-11 bench