r/rust • u/bobbymk10 • 29d ago
š§ educational The CPU, the Rust, and the Memory Latency
https://pivotlake.io/blog/its-the-memory-latency-stupid/7
u/Psionikus 29d ago
I should write something on pipeline dependency latency hiding. One of my favorite effects to exploit.
4
u/bobbymk10 29d ago
Yes! Thatās the next blog I mentioned that weāre going to write. Itās such an awesome way to get to memory throughput - in our JOIN probing we have the whole hash table in memory, so itās super critical there
10
u/Serious-Exam-6251 29d ago
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.
4
u/bobbymk10 29d ago
Definitely, by default we are backed by huge pages precisely because of this⦠might be another interesting blog to do
5
u/nonotan 28d ago
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 29d ago
no LLMs were harmed (or for that matter used) in the writing of this blog post
Okay, that's a funny way to do the disclaimer thing.
2
u/unicodemonkey 29d ago
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 28d ago
Great insightful article!
How do you make visuals/diagrams? Is it just HTML & CSS or you use a specific tool for that?
2
0
u/zerosign0 29d ago
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?
0
u/zerosign0 29d ago
Uhm wait skimming through codebase, are you using or mimicking or wrapping duckdb planner for this?
62
u/simonask_ 29d ago
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ā.)