Skip to content

CSharpLanguage.ToCSharpString usage of StringBuilder not optimal #3057

@ProfFrugal

Description

@ProfFrugal

Steps to reproduce

  1. Open Perfview, capture a trace
  2. Use ILSpy to do some searching/navigation
  3. Stop trace, check allocation stack

CSharpLanguage.ToCSharpString usage of StringBuilder not optimal, it's calling bunch of StringBuilder.Insert(0, x), then StringBuilder.ToString. In most case, there should be ony a single string, so no allocation is needed.

For more detailed analysis/suggestion: check
https://www.linkedin.com/feed/update/urn:li:activity:7097628892848410624/
https://app.beehiiv.com/posts/b3c9d7bb-56ec-4a71-8070-78e23cbc2c80/analytics

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions