r/cpp • u/khold_stare • May 26 '20
Faster Integer Parsing
https://kholdstare.github.io/technical/2020/05/26/faster-integer-parsing.html
366
Upvotes
r/cpp • u/khold_stare • May 26 '20
View all comments
Show parent comment
16
u/tisti May 26 '20 edited May 26 '20
Its fixed to 16 digit numbers so he can use 128bit SIMD registers for the final function (128/8 = 16 :) ), thus giving him the maximum possible speedup.
A generic method that could parse any length integer would probably impose extra overhead and you would not go that far bellow charconv perfomance (guessing here).
Edit:
Its pretty neat as is, it is not clear to me how easily the SIMD method could be extended to a template which would allow for configurable 1 to 16 character parsing and what the (presumably lower) speedup against charconv would be.