Permformance issue with StaticAssetDevelopmentRuntimeHandler.EnableSupport
.
#59673
Labels
area-blazor
Includes: Blazor, Razor Components
When
StaticAssetDevelopmentRuntimeHandler.EnableSupport
is enabled in the development environment, websites with many static resources may experience significant delays.The delay occurs primarily during the first request due to an
O(n^2)
loop in theUpdateEndpoints
process.Each static resource endpoint builder invokes the
AttachRuntimePatching
method and then theFindOriginalAsset
method to iterate through all descriptors.If there are
10,000
static files(js/css/images
) under thewwwroot
folder, this leads to10,000 x 10,000
iterations on the first request.Thanks.
aspnetcore/src/StaticAssets/src/StaticAssetsEndpointRouteBuilderExtensions.cs
Lines 39 to 42 in af22eff
aspnetcore/src/StaticAssets/src/StaticAssetEndpointDataSource.cs
Lines 99 to 119 in af22eff
aspnetcore/src/StaticAssets/src/Development/StaticAssetDevelopmentRuntimeHandler.cs
Lines 29 to 38 in af22eff
aspnetcore/src/StaticAssets/src/Development/StaticAssetDevelopmentRuntimeHandler.cs
Lines 145 to 156 in af22eff
The text was updated successfully, but these errors were encountered: