Reduce allocations in XmlWriterApiTests.TCFullEndElement#112688
Merged
akoeplinger merged 2 commits intodotnet:mainfrom Feb 19, 2025
Merged
Reduce allocations in XmlWriterApiTests.TCFullEndElement#112688akoeplinger merged 2 commits intodotnet:mainfrom
akoeplinger merged 2 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/libraries/System.Private.Xml/tests/Writers/XmlWriterApi/TCFullEndElement.cs:6314
- The variable name 'UniStr' should be renamed to 'uniStr' for consistency with the rest of the code.
string UniStr = "";
src/libraries/System.Private.Xml/tests/Writers/XmlWriterApi/TCFullEndElement.cs
Outdated
Show resolved
Hide resolved
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-xml |
This was referenced Feb 19, 2025
EgorBo
reviewed
Feb 19, 2025
| for (int i = 0; i < strBase64Len; i++) | ||
| { | ||
| strBase64 += "A"; | ||
| strBase64Builder.Append("A"); |
Member
There was a problem hiding this comment.
should this be new string('A', strBase64Len) instead?
Member
Author
There was a problem hiding this comment.
Thanks, forgot about this overload.
akoeplinger
approved these changes
Feb 19, 2025
Member
akoeplinger
left a comment
There was a problem hiding this comment.
LGTM apart from Egor's suggestion.
Comment on lines
+6315
to
+6318
| int charCount = (int)('\ufffe' - '\ue000'); | ||
| StringBuilder uniStrBuilder = new StringBuilder(charCount); | ||
|
|
||
| for (char ch = '\ue000'; ch < '\ufffe'; ch++) |
Member
There was a problem hiding this comment.
nitpick: extract the chars to make it a bit more readable:
Suggested change
| int charCount = (int)('\ufffe' - '\ue000'); | |
| StringBuilder uniStrBuilder = new StringBuilder(charCount); | |
| for (char ch = '\ue000'; ch < '\ufffe'; ch++) | |
| char startChar = '\ue000'; | |
| char endChar = '\ufffe'; | |
| int charCount = (int)(endChar - startChar); | |
| StringBuilder uniStrBuilder = new StringBuilder(charCount); | |
| for (char ch = startChar; ch < endChar; ch++) |
akoeplinger
approved these changes
Feb 19, 2025
grendello
pushed a commit
to grendello/runtime
that referenced
this pull request
Feb 19, 2025
* Reduce allocations in XmlWriterApiTests * Apply code review improvements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Attempt to improve #110090 without disabling tests.