This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Repository navigation
Use cached empty arrays for "".ToCharArray - #5504
Merged
Merged
Conversation
There was a problem hiding this comment.
Any reason for combining the 2 fixed statements? I personally find it easier to read when each variable is in its own statement.
Author
There was a problem hiding this comment.
No reason in particular; I'll change it back in a minute or two to multiple fixed statements.
|
Thanks for fixing this! |
jamesqo
force-pushed
the
empty-tochararray
branch
from
June 6, 2016 22:18
4c082c7 to
1ceb294
Compare
Member
|
Could you please port the fix to CoreRT as well? |
jkotas
pushed a commit
to dotnet/corert
that referenced
this pull request
Jun 7, 2016
Port dotnet/coreclr#5504 to corert
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
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.
Currently, if you do
"".ToCharArray()it will always allocate a new array. I changed it to useArray.Empty<char>for CoreCLR, but fallback to the old behavior of returning a new array each time on the .NET Framework.As we have to make the length check anyway (for
fixed) I think this is basically a free perf gain.cc: @AlexGhiondea @jkotas