Uh oh!
There was an error while loading. Please reload this page.
Remove most of string.Trim() usages in System.Private.Xml solution. - #75452
Conversation
ghost
commented
Sep 12, 2022
Tagging subscribers to this area: @dotnet/area-system-xml Issue DetailsRemove most of string.Trim() usages in System.Private.Xml solution. Several one left, but it is hard to be replaced as code around them expects string and there is no ReadOnlySpan overload.
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
eiriktsarpalis
left a comment
There was a problem hiding this comment.
LGTM superficially, although @krwq might want to take a look as well since he's more familiar with the codebase.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There appear to be |
TrayanZapryanov
commented
Sep 13, 2022
@eiriktsarpalis Maybe related to #74488 |
@eiriktsarpalis test fail should be connected with issue that I mentioned.
|
Uh oh!
There was an error while loading. Please reload this page.
| public static double ToDouble(string s) | ||
| { | ||
| ArgumentNullException.ThrowIfNull(s); |
There was a problem hiding this comment.
interestingly this currently throws NRE
There was a problem hiding this comment.
@krwq This is to mimic current behavior. Check upper comment which shows difference when using double/float.Parse(string...) and double/float.Parse(ReadOnlySpan...) and passing null.
runtime/src/libraries/System.Private.CoreLib/src/System/Single.cs
Lines 387 to 398 in b40c3a3
krwq
commented
Sep 26, 2022
Thanks @TrayanZapryanov! Please file an issue on #75452 (comment) if you get a chance |
Remove most of string.Trim() usages in System.Private.Xml solution.
They are replaced with string.AsSpan().Trim(XmlConvert.WhitespaceChars).
If string really contains a space - this will reduce one string allocation.
Several one left, but it is hard to be replaced as code around them expects string and there is no ReadOnlySpan overload.