Skip to content

Comment on Beating the L1 cache with value speculationparent

Comments

That looks weird, why would you need to test if two values are equal if you’re going to assign them to be equal anyway?

That is the trick.

In the happy path you are not assigning(`node=next`).

It is taken care of by `node++`, which removes the loop dependency and the processor can use the full instruction level parallelism.

It looks like a bug. The unhappy path contains both `node++` and `node=node->next`. Note that this is in the code following "Let’s go back to the code we showed for value speculation in C:", which is actually different from the preceding code it's supposed to be a copy of. I guess it's a typo.

The author has fixed this discrepancy now.

It looks as if the difference is in delaying the check for next == NULL.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.