Skip to content

Allocation practice problems in Rust

Difficulty:
Category:
Tag:

Showing 15 of 15

Status Title Difficulty
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
Cow: borrow until you have to own Medium
Enum dispatch: the third option Medium
In-place mutation vs rebuild, measured Easy
Iterator performance: where the abstraction leaks 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
Sorting: sort vs sort_unstable vs sort_by_cached_key Medium
String and text performance, graded Medium
String building: push_str, write!, and the 590x cliff Easy
Where the allocations are: the counting allocator Easy
Zero-copy parsing: borrow, don't allocate Medium