Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use string.Create instead of StringBuilder in BitVector32.ToString #30528

Merged
merged 1 commit into from Jun 20, 2018

Conversation

Projects
None yet
2 participants
@stephentoub
Copy link
Member

commented Jun 19, 2018

Removes the StringBuilder and underlying char[] allocation, and just writes directly into the resulting string.

cc: @safern, @ianhays

Use string.Create instead of StringBuilder in BitVector32.ToString
Removes the StringBuilder and underlying char[] allocation, and just writes directly into the resulting string.

@stephentoub stephentoub added this to the 3.0 milestone Jun 19, 2018

@safern

safern approved these changes Jun 20, 2018

Copy link
Member

left a comment

Nice! Thanks @stephentoub

@stephentoub stephentoub merged commit f3eec79 into dotnet:master Jun 20, 2018

15 checks passed

CROSS Check Build finished.
Details
Linux arm Release Build Build finished.
Details
Linux arm64 Release Build Build finished.
Details
Linux x64 Release Build Build finished.
Details
Linux-musl x64 Debug Build Build finished.
Details
NETFX x86 Release Build Build finished.
Details
OSX x64 Debug Build Build finished.
Details
Packaging All Configurations x64 Debug Build Build finished.
Details
Tizen armel Debug Build Build finished.
Details
UWP CoreCLR x64 Debug Build Build finished.
Details
UWP NETNative x86 Release Build Build finished.
Details
WIP ready for review
Details
Windows x64 Debug Build Build finished.
Details
Windows x86 Release Build Build finished.
Details
license/cla All CLA requirements met.
Details

@stephentoub stephentoub deleted the stephentoub:bitvecttostring branch Jun 20, 2018

}
else
ReadOnlySpan<char> prefix = "BitVector32{";
prefix.CopyTo(dst);

This comment has been minimized.

Copy link
@safern

safern Jun 20, 2018

Member

Should we add an API to span to insert a ReadOnlySpan?

So that instead of doing:

ReadOnlySpan<char> prefix = "BitVector32{"
prefix.CopyTo(dst);

We just call that API like:

dst.Insert(index: 0, readOnlySpan<char>: "BitVector32{");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.