logoalt Hacker News

metabageltoday at 5:04 PM2 repliesview on HN

OK, but the code with the branch is easier to understand.


Replies

robby_w_gtoday at 5:19 PM

Yeah, I don't buy the premise that branchless code is intrinsically easier to understand. Maybe OP's point is that adding unnecessary branches makes code harder to read? But that's generally the case for any unnecessary code.

show 1 reply
jamiejquinntoday at 5:16 PM

Generally agree. As with many optimisations, branchless code can easily be less obvious than the branchy equivalent.