Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use FormattingHelpers.Count{Hex}Digits in {u}int/long.ToString/TryFormat
Currently we create a temporary buffer on the stack, format into it, and then copy from that stack buffer into either the target span (for TryFormat) or into a new string (for ToString. Following the approach as (and sharing the same code from) Utf8Formatter, where it first counts the number of digits in the output in order to determine an exact length, this commit changes the implementation to skip the temporary buffer and just format directly into the destination span or string. This results in a very measurable performance boost.
- Loading branch information