
Blocking the Tokio Runtime and How to Find the Culprit
One blocking call inside an async task can freeze a worker thread. See how it happens, how to find it and the three fixes: spawn_blocking, a thread, or async APIs.
Profilers, flamegraphs, benchmarks and caches: find the slow part first, then fix only that.

One blocking call inside an async task can freeze a worker thread. See how it happens, how to find it and the three fixes: spawn_blocking, a thread, or async APIs.

Static dispatch resolves the call at compile time and dynamic dispatch looks it up in a vtable at run time. See the layout, the cost and when it matters.

cargo build is slow to run and fast to compile, cargo build --release is the reverse. See what each profile changes, how to measure the gap and how to tune the dev profile.

Generic Rust code is compiled once per concrete type, which is why it is as fast as hand written code and why binaries grow. See what that looks like.

The handful of habits behind most Rust speed: build in release, avoid needless allocation, use iterators and slices, pick the right collection and measure before tuning.

Box<dyn Trait> costs one allocation and one indirect call per use. Learn what that costs, when it is worth it and the cheaper alternatives.

Choose between Vec, VecDeque, HashMap, HashSet, BTreeMap and BTreeSet by the operations you need, with complexity, ordering and memory notes.

A guide to making Rust programs faster by measuring first: release builds, flamegraphs, allocation counts, benchmarks and the order to look at things.

Integer overflow panics in a debug build and wraps in a release build. See the exact behavior, the checked, wrapping and saturating methods, and the setting that changes it.
We send one email when a new post is published. No spam.