Improve throughput of UInt32/UInt64 integer parsing (dotnet/coreclr#18930)
authorStephen Toub <stoub@microsoft.com>
Mon, 16 Jul 2018 13:59:55 +0000 (06:59 -0700)
committerGitHub <noreply@github.com>
Mon, 16 Jul 2018 13:59:55 +0000 (06:59 -0700)
commit28b7fa76f7bd0a29bcc43244c993b339a35ee96f
tree0780b268b9796dac2ecf5070a3ba4598cbb2908a
parent4f4d90b5ad10f454a7af686f65b823fe61ec5c66
Improve throughput of UInt32/UInt64 integer parsing (dotnet/coreclr#18930)

As was recently done for Int32/Int64, ports the Utf8Parser approach to parsing to UInt32/UIn64.{Try}Parse, specifically for NumberStyles.Integer (the default).

Also fixes an issue discovered in the previous Int32/Int64 changes, where if the input both has an overflow and has a formatting error (e.g. Int32.Parse("12345678910blah"), we would end up throwing whichever error was hit first, which is a change from .NET Core 2.1 and netfx.  The FormatException needs to be preferred over the OverflowException, which just means we can't bail early when overflow is detected.

Commit migrated from https://github.com/dotnet/coreclr/commit/ce0a2617d40bc217b8e0a2137e340afe585afcb1
src/libraries/System.Private.CoreLib/src/System/Number.Parsing.cs