-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
Milestone
Description
Various code paths end up allocating as part of calling DateTimeResult.SetFailure(ParseFailureKind, object), boxing a value type second argument. For DateTime.Parse, this is reasonable, given we're about to throw an exception. But for TryParse, it should still be as cheap as possible even on failure to parse; it's often used as part of multiple checks to determine the format of a given piece of data, so failure to parse still happens on hot / success paths (e.g. after checking whether it's a DateTime and determining it's not, it might successfully parse as something else).