[PATCH] Optimize to_chars

Jonathan Wakely jwakely@redhat.com
Mon Sep 9 11:13:00 GMT 2019


On 08/09/19 16:44 +0300, Antony Polukhin wrote:
>We've already beaten this topic to death, so let's put a final nail in
>the coffin:
>
>
>__to_chars_10_impl is quite fast. According to the IACA the main loop
>takes only 6.0 cycles, the whole function with one iteration takes
>10.0 cycles. Replacing the __first[pos] and __first[pos - 1] with
>__first[0] and __first[1] drops the function time to 7.53 cycles.
>
>Changelog:
>
>2019-09-08  Antony Polukhin  <antoshkka@gmail.com>
>
>    * include/bits/charconv.h (__detail::__to_chars_10_impl): Replace
>    final offsets with constants.

Excellent, thanks for the patch and all the benchmarking!

I've committed this to trunk now.




More information about the Libstdc++ mailing list