Skip to content

WebApplication.CreateBuilder potentially inefficient, results in many file system checks #32432

@DamianEdwards

Description

@DamianEdwards

While debugging through #32415 I noticed that the call to WebApplicaiton.CreateBuilder(args) results in nine calls to WebHostEnvironment.ResolveFileProviders(), which in turn does multiple file system checks via Directory.Exists and creates new instances of PhysicalFileProvider.

This seems inefficient and will potentially impact startup time on systems with slower drives (spinning rust, cloud-mapped drives, etc.) or with AV running. We should investigate whether this can be optimized.

@halter73 @davidfowl

Metadata

Metadata

Assignees

No one assigned

    Labels

    Perfarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-minimal-hosting

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions