Skip to content

Performance practice problems in Rust

Difficulty:
Category:
Tag:

Showing 23 of 23

Status Title Difficulty
Auto-vectorisation and why floating-point addition blocks it Hard
Bounds checks: when they cost, and five safe ways to remove them Hard
Capacity and pre-sizing, graded Easy
Case-insensitive search without allocating Easy
Chains versus loops: top-k, and a function that must not allocate Medium
const fn and compile-time evaluation Hard
Const generics: moving a size from runtime to compile time Hard
Custom hashing: beating SipHash on integer keys Hard
Enum dispatch: the third option Medium
#[inline], #[inline(always)], #[cold] and the codegen-unit trap Hard
In-place mutation vs rebuild, measured Easy
Iterator performance: where the abstraction leaks Medium
`large_enum_variant`: boxing the fat variant Medium
Memory layout and cache behaviour: flat arrays, AoS vs SoA Medium
Needless clone: the most common review comment in Rust Medium
Reusing buffers instead of allocating per iteration Medium
size_hint and DoubleEndedIterator: an iterator with two ends Hard
Sorting: sort vs sort_unstable vs sort_by_cached_key Medium
Static vs dynamic dispatch, measured Hard
String and text performance, graded Medium
String building: push_str, write!, and the 590x cliff Easy
Type sizes, enum layout and niche optimisation Medium
Where the allocations are: the counting allocator Easy