This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Optimize to_chars
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Antony Polukhin <antoshkka at gmail dot com>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 9 Sep 2019 12:13:19 +0100
- Subject: Re: [PATCH] Optimize to_chars
- References: <CAKqmYPZh+KXP3J_5X3xmz=-D0h013_w201Z=E5e56sfvCtAr1A@mail.gmail.com> <20190830160126.GO9487@redhat.com> <20190830160857.GP9487@redhat.com> <20190902113226.GW9487@redhat.com> <CAKqmYPZveokZBA7=x2qpFuCKqp45zca7+WQyhr-e9bA2kgVn0w@mail.gmail.com>
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.