Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #110389 - mazong1123:add-shortcut-for-grisu3, r=Mark-Si…
…mulacrum Add shortcut for Grisu3 algorithm. While Grisu3 is way more faster for most numbers compare to Dragon4, the fall back to Dragon4 procedure for certain numbers could cause some performance regressions compare to use Dragon4 directly. Mitigating the regression caused by falling back is important for a largely used core library. In Grisu3 algorithm implementation, there's a shortcut to jump out earlier when the fractional or integrals cannot meet the requirement of requested digits. This could significantly improve the performance of converting floating number to string as it falls back even without starting trying the algorithm. The original idea is from the [.NET implementation](https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/Number.Grisu3.cs#L602-L615) and the code was originally added in [this PR](dotnet/coreclr#14646 (comment)). This shortcut has been shipped long time ago and has been proved working. Fix #110129
- Loading branch information