Skip to content

Remove StringBuilderCache from System.Runtime.Extensions #26324

@JeremyKuhne

Description

@JeremyKuhne

System.Runtime.Extensions still uses StringBuilderCache in a few places. The usage should be replaced with ValueStringBuilder, with an initial reasonably sized stackalloc'ed char array. E.g:

    Span<char> initialBuffer = stackalloc char[32];
    var builder = new ValueStringBuilder(initialBuffer);

First Location

System.ApplicationId.ToString()

https://github.com/dotnet/corefx/blob/6dd451f51451a7d0ceea6104b51bd17005e9a0e6/src/System.Runtime.Extensions/src/System/ApplicationId.cs#L42-L68

Second location

System.Net.WebUtility.HtmlEncode()

https://github.com/dotnet/corefx/blob/6dd451f51451a7d0ceea6104b51bd17005e9a0e6/src/System.Runtime.Extensions/src/System/Net/WebUtility.cs#L168-L174

Third location

System.Environment.ExpandEnvironmentVariablesCore() (on Unix, Windows already changed)

https://github.com/dotnet/corefx/blob/2c734d6db0a8009150bac59f13960f463528ba76/src/System.Runtime.Extensions/src/System/Environment.Unix.cs#L31-L55

Metadata

Metadata

Assignees

Labels

HackathonIssues picked for Hackathonarea-System.RuntimeenhancementProduct code improvement that does NOT require public API changes/additionshelp wanted[up-for-grabs] Good issue for external contributors

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions