It could get the same result if the condition function is not called. But checking the destination before compare and swap could reduce the contention and improve the concurrency. Checking the condition takes one read, while updates need to do compare and swap which needs exclusive access the data. Doing an additional check before updating is efficient because the update is not necessary for most of the time. This idea is discussed in a previous lecture.
It could get the same result if the condition function is not called. But checking the destination before compare and swap could reduce the contention and improve the concurrency. Checking the condition takes one read, while updates need to do compare and swap which needs exclusive access the data. Doing an additional check before updating is efficient because the update is not necessary for most of the time. This idea is discussed in a previous lecture.