Unsafe & Layout - learning from brrr
reddit.com·1d·
Discuss: r/rust
⚙️Systems Programming
Preview
Report Post

Hi all,

For the longest part I’ve been doing normal Rust, and have gone through Jon’s latest video on the 1brc challenge and his brrr example.

This was great as a couple aspects “clicked” for me - the process of taking a raw pointer to bytes and converting them to primitive types by from_raw_parts or u64::from_ne_bytes etc.

His example resolves around the need to load data into memory (paged by the kernel of course). Hence it’s a read operation and he uses MADV to tells the system as such.

However I am struggling a wee bit with layout, even though I conceptually understand byte alignment (https://garden.christophertee.dev/blogs/Memory-Alignment-and-Layout/Part-1) in terms of coming up with a sma…

Similar Posts

Loading similar posts...