Fast integer to decimal conversion

后端 未结 4 1845
借酒劲吻你
借酒劲吻你 2021-01-03 09:36

Given an (unsigned) integer, what is the generally fastest way to convert it into a string that contains its decimal representation?

The naïve way of doing that

4条回答
  •  日久生厌
    2021-01-03 10:10

    The generally fastest way is to index into a big enough array of pointers to strings. One array lookup, one pointer dereference. It's heavy on memory usage, though... That's the nature of engineering tradeoffs. How fast is fast enough?

提交回复
热议问题