Remove ToString from RuntimeAssembly.GetManifestResourceStream#22012
Conversation
A small allocation we can avoid with the span-based string.Concat.
|
There's one more instance of the same code in |
| string delimiter = (nameSpace != null && name != null) ? Type.Delimiter.ToString() : null; | ||
| string resourceName = string.Concat(nameSpace, delimiter, name); | ||
|
|
||
| char c = Type.Delimiter; |
There was a problem hiding this comment.
If you feel like it you could change nameSpace to namespace ...
There was a problem hiding this comment.
Not without putting an @ in front of it, as it's a reserved keyword.
|
|
||
| char c = Type.Delimiter; | ||
| string resourceName = nameSpace != null && name != null ? | ||
| string.Concat(nameSpace, new Span<char>(ref c, 1), name) : |
There was a problem hiding this comment.
ReadOnlySpan to avoid Span->ReadOnlySpan cast?
There was a problem hiding this comment.
Yup. I'm pretty sure I've made this mistake in other places, too; I'll do a pass to clean them up.
Thanks, @filipnavara. If I merge this, will that mess up your work? |
It's fine, I will rebase the other PR. |
|
@dotnet-bot test Windows_NT x64 Checked CoreFX Tests please |
Ok, thanks! |
…t/coreclr#22012) * Remove ToString from RuntimeAssembly.GetManifestResourceStream A small allocation we can avoid with the span-based string.Concat. * Address PR feedback Commit migrated from dotnet/coreclr@b9788c2
A small allocation we can avoid with the span-based string.Concat.