Skip to content

Improve Uri.UnescapeDataString codepath -> UriHelper.UnescapeString #20177

@safern

Description

@safern

After doing an investigation on some performance traces collected from some mvc aspnet applications scenarios we found that a considerable amount of char[] objects were allocated on the GC Heap which are coming from Uri.UnescapeDataString codepath that is calling UriHelper.UnescapeString (source code) which receives a char[] as the destination of the unescaped string and then creating a string from that char[].

I know it would be a big change but we could probably consider using the sourceString that is already allocated or using a PooledStringBuilder which uses an ArrayPool for the buffer cache as explained here:

/cc @danmosemsft @jkotas @stephentoub

Metadata

Metadata

Assignees

Labels

area-System.NetenhancementProduct code improvement that does NOT require public API changes/additionshelp wanted[up-for-grabs] Good issue for external contributorstenet-performancePerformance related issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions