Skip to content

Consider creating new dictionary type which allocates an array for small capacities instead of an entire dictionary #31290

@jkotalik

Description

@jkotalik

We allocate a lot of dictionaries across ASP.NET Core, which have a non-zero allocation cost to them. An interesting idea would be to see if we could use an array internally for smaller sizes.

We already do this today in Routing: https://github.com/dotnet/aspnetcore/blob/main/src/Http/Http.Abstractions/src/Routing/RouteValueDictionary.cs. I think we could probably use RouteValueDictionary (or a copy of it) in different places across the stack.

Metadata

Metadata

Assignees

Labels

Perfarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions