Re:Inverting a binary tree using x64 assembly
by MobiusHorizons on Friday November 25, 2022 @02:12AM
(#33740019)
The top of the stack should generally be already present in the cache, so stack memory would be faster than heap memory where objects aren’t necessary as close together or accessed as frequently.
Re:Inverting a binary tree using x64 assembly
by xgkickt on Friday November 25, 2022 @05:39AM
(#33741088)
Register reordering. Stack references are more likely to be in the register file.
Re:Inverting a binary tree using x64 assembly
by menaerus on Friday November 25, 2022 @05:48AM
(#33741152)
I am not familiar with any other reason besides the fact that stack-pointer arithmetics are done through a dedicated HW, called stack-engine, which sits in the CPU frontend. This effectively means that stack-pointer uOps are going to be get executed quicker because they do not have to go all the way through the CPU backend processing. This also saves some of the bandwidth on the CPU backend side allowing other uOps to be processed sooner.
Why are variables on the stack more efficient than other memory accesses?