News for hackers. Stuff that matters.
Re:Anything can be a message queue if you use it wrongly enough by twoodfin on Sunday June 04, 2023 @06:05PM (#36190041)
By definition, everything on the heap got where it is dynamically, so the minimum number of pointers to chase to find it is 1.

In contrast, what’s where on the stack can often be (and often must be) known statically by the compiler and accessed directly, even moved entirely out of memory and into a register. (It’s possible to do this with suitably constrained dynamic allocations, but the optimization is much harder.)

Re:Anything can be a message queue if you use it wrongly enough by cdcarter on Sunday June 04, 2023 @10:25PM (#36191576)
Some architectures (e.g. the 65816, the 6502's "big brother" used in the Apple IIgs) include stack pointer relative addressing modes, which will complete the memory read and return data faster than the same instruction with a full address encoded.