Skip to content

Perf improvement opportunities #612

Description

@AArnott

As a continuation of ongoing perf work, this issue tracks perf improvement opportunities.

  • Calling PEReaderExtensions.GetMetadataReader is apparently quite slow because of some in-memory buffer copies. We can pool and recycle the result of this call.
  • TryGetEnumName exhaustively searches all enum values in the metadata on every call. On subsequent generations, we should be able to reuse the result of this search rather than repeating it.
  • GetMethodsByName spends a lot of time concatenating strings and in 3 dictionary lookups per namespace in the search. We may be able to consolidate this to just 1 dictionary lookup with no string concatenation.
  • TryGenerateConstant spends a lot of time in direct dictionary lookups (one lookup per namespace searched). We might be able to get this down to just one lookup.
  • TryGenerateType spends a lot of time in direct dictionary lookups (one lookup per namespace searched). We might be able to get this down to just one lookup.
  • SyntaxNode.GetText, which renders the syntax tree to a SourceText, takes a significant amount of time (as of course does the production of the syntax tree. If we could cache this and safely determine when we can reuse it, that would be supreme.

Some of these items come from this table.
See also #244 for prior work in this area.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions