Avoid boxing, object[], and string[] allocations in BuildTraceFileName by stephentoub · Pull Request #21752 · dotnet/coreclr (original) (raw)

Conversation

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

[ Show hidden characters]({{ revealButtonHref }})

stephentoub

This was calling the string.Concat(object[]) overload, which entailed boxing the process ID and allocating an object[]; then string.Concat would allocate a string[] to store the ToString results of all arguments. By calling ToString on the process ID ourselves, we avoid the boxing, the object[], and the string[] (there's a four-string Concat overload).

@stephentoub

@stephentoub stephentoub changed the titleAvoid boxing allocation, object[], and string[] allocations in BuildTraceFileName Avoid boxing, object[], and string[] allocations in BuildTraceFileName

Jan 2, 2019

adamsitnik

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

brianrob

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@brianrob

picenka21 pushed a commit to picenka21/runtime that referenced this pull request

Feb 18, 2022

@stephentoub