|
|
|
|
|
by mistercow
712 days ago
|
|
It’s interesting to me that the final assembly-trick-free version almost no longer looks like a hack. If you commented the inner loop with something like “// Linear scan for adjacent nodes”, the reader gets an OK, if incomplete, intuition for why it’s faster. Even if you don’t know the exact CPU details, if you’re aware that flat arrays usually loop faster than contiguous linked lists, the nested loop immediately reads as a kind of “hybrid mode”. |
|
I want to understand, in:
How is this magic: Better than the more intuitive: Also.. why is `node + 1' even a valid comparison? (Please forgive my rusty C/C++, college was awhile ago)