Remix.run Logo
bob1029 4 hours ago

> So, yes, it takes time to read from memory. That's why we try to avoid allocations as much as possible.

This whole thing is summed up by some pretty basic physics. What you actually want to minimize is the communication of information between physical cores. Nothing else really matters. Certainly not terminology or clever tricks that effectively try to cheat thermodynamics. The cost of communicating information is almost always much more substantial than the cost of computing over that same information. The ALU is not nearly as power hungry as infinity fabric.

hrmtst93837 17 minutes ago | parent | next [-]

Minimizing core-to-core communication is a nice theory until you actually run workloads with unpredictable access patterns or legacy interfaces bolted on where you can't just flatten and pack everything for optimal cache locality. There's a whole separate world of pain once you start scaling out mutability and pointer-heavy structures: you get play-by-play races between TLB shootdowns, OS-level dirty page tracking and whatever the thread scheduler feels like that day.

pjmlp 28 minutes ago | parent | prev | next [-]

In the old Windows NT days, the scheduler still wasn't that clever, so in multiple core servers it would throw processes around thrashing the whole cache and CPU context.

By pinning the processes to specific CPUs, the performance gains were quite visible.

chuzz 4 hours ago | parent | prev | next [-]

Always wondered if it is possible/useful to model multi core CPU caches as CISC cores where the complex instructions are all the operations you can do with the L1 within the time frame of an L2 access

mgaunard 4 hours ago | parent | prev [-]

What the hell do allocations even have to do with time to read from memory...

It seems all of these Rust performance warriors have no understanding of computer architecture fundamentals.

menaerus an hour ago | parent | next [-]

It's not rust per se. It's a human trait. People make uneducated assumptions about the topics all of the time, and it's completely normal since your have to bootstrap yourself somehow to be able to grow further. It's impossible to know everything. And it's also a difficult situation because you do have to arrive to some conclusion. I do think, though, that in this particular case, assumptions made are a little bit all over the place and the tone is overconfident.

hinkley an hour ago | parent | prev [-]

If an allocation falls in a forest and never gets written to, did it really happen?

We don’t allocate things we don’t write to. Maybe if the question sounds stupid then you didn’t appreciate it, instead of other people being stupid.