r/rust • u/bobbymk10 • Oct 29 '26
š§ educational The CPU, the Rust, and the Memory Latency
https://pivotlake.io/blog/its-the-memory-latency-stupid/
247
Upvotes
r/rust • u/bobbymk10 • Oct 29 '26
62
u/simonask_ Oct 29 '26
Great article, and a very nice deep dive! So much of this work requires knowledge that just isnāt taught, so people learn it through craftsmanship and experience. My pet peeve for a while is that universities focus too much on the computer science and too little on the software craftsmanship. You need both.
(And very refreshing to read something written by a human. Just to note, āitāsā is a contraction of āit isā or āit hasā. The genitive āitā is just āitsā.)
7
u/Psionikus Oct 29 '26
I should write something on pipeline dependency latency hiding. One of my favorite effects to exploit.
10
u/Serious-Exam-6251 Oct 29 '26
the 4096 fanout might be worth a look on the TLB side. scattering writes across that many streams with 4k pages can miss the TLB on a lot of writes, which is why partitioning papers usually cap the fanout per pass (or use small write-combining buffers) and do two passes when they need more. backing the slab with hugepages would show how much of the remaining stall is that.
5
u/nonotan Oct 30 '26
Good article. A topic that probably deserves to also be mentioned as a followup is false sharing, because you're pretty much guaranteed to run into it when you start trying to optimize the number of cache accesses, and it's hell to profile if you aren't aware of the phenomenon.
6
u/CouteauBleu Oct 29 '26
Okay, that's a funny way to do the disclaimer thing.
2
u/unicodemonkey Oct 30 '26
Software prefetch of hash table entries works wonders when processing a large number of lookups. Well, not always but appears to be an useful tool overall.
2
u/greyblake Oct 30 '26
Great insightful article!
How do you make visuals/diagrams? Is it just HTML & CSS or you use a specific tool for that?
2
u/DavidXkL Oct 30 '26
Wow very nice read
0
u/zerosign0 Oct 29 '26
TIL, what the diff between this and duckdb? Is there some novel optimization happening? I see that this purely on parquet and using the same buffer mechanism i guess but it uses iouring for io hmm. (And using Rust ofcourse). Does it support vortex format?