Skip to content

Consider improvements to reduce allocations in validation filter logic #61222

Closed
@captainsafia

Description

@captainsafia

We want to reduce the number of allocations accumulated by the validation filter logic and make the implementation as pay-to-play as possible. When users are not leveraging the feature we should consider:

  • Avoiding allocating arrays to construct IValidatableInfo instances for parameters that don't require them
  • Reuse ValidationContext objects throughout the pipeline to avoid newing them up per handler argument
  • Avoid closure allocations in EndpointFilterDelegate returned from the filter factory
  • Cache reflection calls for implemented subtypes in ValidatableTypeInfo

Metadata

Metadata

Assignees

Labels

area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-validationIssues related to model validation in minimal and controller-based APIs

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions