Skip to content

RedirectRule: opportunity for performance improvement #28883

Closed
@paulomorgado

Description

@paulomorgado

Summary

  1. RedirectRule.ApplyRule is comparing the request path with PathString.Empty, which ends up being a string comparison.
  2. RedirectRule.ApplyRule is boxing a PathString(1)(2).

Motivation and goals

This is in a hot path for applications that use redirections.

Detailed design

  1. Use path.HasValue instead.
  2. Use pathBase.ToUriComponent() instead.
    • A better option would be use UriHelper.BuildRelative. The current implementation doesn't encode the path; only the path base and the query string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.Perfarea-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresdesign-proposalThis issue represents a design proposal for a different issue, linked in the description

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions