Skip to content

Consider improvements to reduce allocations in validation filter logic #61222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
captainsafia opened this issue Mar 28, 2025 · 0 comments · May be fixed by #62056
Open

Consider improvements to reduce allocations in validation filter logic #61222

captainsafia opened this issue Mar 28, 2025 · 0 comments · May be fixed by #62056
Assignees
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc feature-validation Issues related to model validation in minimal and controller-based APIs
Milestone

Comments

@captainsafia
Copy link
Member

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
@captainsafia captainsafia added area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc feature-validation Issues related to model validation in minimal and controller-based APIs labels Mar 28, 2025
@captainsafia captainsafia added this to the Backlog milestone Mar 28, 2025
@Copilot Copilot AI linked a pull request May 22, 2025 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc feature-validation Issues related to model validation in minimal and controller-based APIs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant