moq.analyzers
moq.analyzers copied to clipboard
Performance optimization: Replace ToDisplayString() with direct symbol property access in benchmarks
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