3 ms·
It likely is faster because it avoids more branching altogether, thus branch mis-predictions.
by lucian1900 14y ago
It likely is faster because it avoids more branching altogether, thus branch mis-predictions.
- ww520 14y agoBut memory access is more expensive. Double de-referencing a pointer to pointer might perform worse.
- stephencanon 14y agoThere is actually no difference in the memory access pattern of the two approaches, unless your compiler is entirely out to lunch. Memory is only touched in either approach to: a. loading the address of the next node. b. updating the link address when a node is deleted. which are performed the same number of times on the same underlying data in either approach.
- kabdib 14y agoSee above comment about load-hit-stores. Memory order and what's in flight in the pipeline matter in surprising ways.