logoalt Hacker News

Brian_K_Whitetoday at 3:47 AM0 repliesview on HN

Another recent story from github about case folding as part of code search, the simple version of the code had a couple of ifs, and the branchless version was actually slower.

They have a stupendously fast version and it is also branchless, but it just required more than branchless alone.

I'm fuzzy on the details but I think one of the ifs was an early exit, and without that the loop does a memory assignment on every byte instead of skipping most.

The really fast version was also vectorized. The branchless makes it possible to vectorize, but it was the vectorization that actually made it fast.