Splat.DI.SourceGenerator
Splat.DI.SourceGenerator copied to clipboard
Modernize incremental generator: Remove LINQ, optimize performance, add acknowledgments
Modernizes the incremental source generator with significant performance optimizations and project improvements while maintaining the exact same API and functionality.
Performance Optimizations
- Eliminated LINQ usage in hot code paths, replacing with efficient loops for better performance
- Implemented StringBuilder for memory-efficient code generation instead of string concatenation
- Removed 9 legacy files (708 lines of code) that supported the old visitor pattern but were no longer used
- Maintained raw string literals with interpolation for clean, readable generated code
Project Improvements
- Added copyright acknowledgments for PolySharp, Microsoft.CodeAnalysis, and Splat dependencies
- Added AI tools disclosure noting use of GitHub Copilot with human review and testing
- Enhanced README documentation with comprehensive details about the modern 4-stage incremental pipeline architecture
Architecture Benefits
The generator now fully leverages:
- True incremental compilation with cache-friendly immutable records
- Memory-efficient processing with early filtering and minimal allocations
- Independent stage caching for maximum performance benefits
- Immediate IDE feedback during editing in Visual Studio 17.10+
All existing Register<>(), RegisterLazySingleton<>(), and RegisterConstant<>() methods continue to work exactly as before with improved performance.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.