Skip to content

XmlCommentHelper.GetText Performance issues #3619

@ninedan

Description

@ninedan

There are a few performance issues in GetText implementation:

  1. It's recreating regular expression every time, rather costly, especially on .Net framework.
  2. Even using regular expression itself is not idea. The reason is that even single white space is a match when no replacement is actually needed, but it will still be performed.
  3. Usage of reused StringBuilder is not optimal, because new string is always allocated.

Suggestion: do not use regular expression, aim for not a single allocation when no change is needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions