moq.analyzers icon indicating copy to clipboard operation
moq.analyzers copied to clipboard

Performance optimization: Replace ToDisplayString() with direct symbol property access in benchmarks

Open coderabbitai[bot] opened this issue 5 months ago • 0 comments

Summary

The benchmark code in CallbackReturnsSymbolBenchmarks.cs uses containingType.ToDisplayString() which can be relatively expensive compared to accessing symbol properties directly. For performance benchmarks, using more direct symbol property access would be more appropriate.

Context

This issue was identified during code review of the benchmark implementation for callback and returns symbol detection.

References

  • PR: https://github.com/rjmurillo/moq.analyzers/pull/429
  • Comment: https://github.com/rjmurillo/moq.analyzers/pull/429#discussion_r2134957540
  • Reported by: @rjmurillo

Location

File: tests/Moq.Analyzers.Benchmarks/CallbackReturnsSymbolBenchmarks.cs Method: NewIsCallbackOrReturnSymbol

coderabbitai[bot] avatar Jun 09 '25 03:06 coderabbitai[bot]