jm + branchless   1

A Branchless UTF-8 Decoder
This week I took a crack at writing a branchless UTF-8 decoder: a function that decodes a single UTF-8 code point from a byte stream without any if statements, loops, short-circuit operators, or other sorts of conditional jumps. [...] Why branchless? Because high performance CPUs are pipelined. That is, a single instruction is executed over a series of stages, and many instructions are executed in overlapping time intervals, each at a different stage.


Neat hack (via Tony Finch)
algorithms  optimization  unicode  utf8  branchless  coding  c  via:fanf 
9 weeks ago by jm

Copy this bookmark:



description:


tags: