Commit d210653f authored by Patrick Palka's avatar Patrick Palka
Browse files

libstdc++: Micro-optimize __from_chars_pow2_base

In the first iteration of __from_chars_pow2_base's main loop, we need
to remember the value of the leading significant digit for sake of the
overflow check at the end (for base > 2).

This patch manually unrolls this first iteration so as to not encumber
the entire loop with logic that only the first iteration needs.  This
seems to significantly improve performance:

Base  Before  After (seconds, lower is better)
   2    9.36   9.37
   8    3.66   2.93
  16    2.93   1.91
  32    2.39   2.24

libstdc++-v3/ChangeLog:

	* include/std/charconv (__from_chars_pow2_base): Manually
	unroll the first iteration of the main loop and simplify
	accordingly.
parent 021b5181
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment