Moore’s Law, the observation that the number of transistors on a chip doubles roughly every 2 years, ended around 2015–2020. This means CPU bound code that runs slowly will run slowly on future CPUs. The traditional approach of Big-O analysis and algorithmic improvements is no longer accurate, since it only accounts for "op-count" and ignores the cost of memory access. Modern CPUs have many cores, but each core isn't getting any faster. So using parallelism is another way to get more performance. Let's explore memory performance and latency in Rust.
For comments and feedback please use these:
Issue: https://github.com/nazmulidris/rust-s...
Repo: https://github.com/nazmulidris/rust-s...
Article: https://developerlife.com/2025/05/19/...
Chapters:
00:00:00 Intro
00:03:28 Implications of Moore's Law ending
00:07:30 Pointer jumps are expensive
00:10:30 References for data oriented design, allocation, latency
00:11:00 Best practices overview
00:17:20 CPU fetch execute cycle, execute instructions, cache line
00:22:35 Relative latency of memory access (register, L1, L2, GPU, SSD, LAN, WAN)
00:23:30 It is not about opcount (Big-O) anymore
00:23:55 Don't use intuition, measure instead
00:28:30 Latency chart
00:28:57 Stack and heap, Linux, and Rust
00:34:30 Careful of stack overflow
00:35:00 Allocation and drop for stack and heap
00:37:00 Subscribe, feedback, comments
00:38:00 Begin live coding, create new project
00:39:00 Ex 1 - What String and &str look like in memory
01:03:00 Ex 2 - Memory alignment
01:19:00 Ex 3 - Global allocator and jemalloc
01:23:00 Ex 4 - RingBuffer alloc on stack
01:39:00 Ex 4 - Implement a queue API
01:51:00 Ex 5 - smallvec and InlineVec
02:11:00 Ex 6 - smallstr and InlineString
02:30:00 Outro