Improve throughput of UInt32/UInt64 integer parsing (#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)
commitce0a2617d40bc217b8e0a2137e340afe585afcb1
treebf5a5b67633d6c6265d56759340d73f8ab27d025
parent309e9054841f71cbbfad3c9a091724f2978eef3d
Improve throughput of UInt32/UInt64 integer parsing (#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.
src/System.Private.CoreLib/shared/System/Number.Parsing.cs