Skip to content
Opensource internals
  • Posts

Std

collect() Reuses Your Allocation: Rust's In-Place Collection

Oct 21, 2026 5 min read Jay Hubbert

Rust’s in-place collect reuses the source Vec’s allocation when the iterator and element sizes allow it, turning map+collect into a loop with no allocation.

RustInternalsStdPerformanceIterators

Read more →

Vec's Capacity Lives in a Niche: How Rust's RawVec Got One Word Smaller

Oct 21, 2026 6 min read Jay Hubbert

Rust’s RawVec keeps its capacity in a niche-typed UsizeNoHighBit, making Vec three words, with a growth policy of max(2*cap, required) and a tiny-vector minimum of 8 bytes for u8.

RustInternalsStdPerformanceData structures

Read more →

← Newer Page 2 of 2 Older →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·