A Roslyn-based compiler that rewrites LINQ expressions into procedural code to minimize allocations and dynamic dispatch in C#.
roslyn-linq-rewrite is a custom C# compiler that rewrites LINQ expressions into optimized procedural code during the build process. It solves performance issues in LINQ-heavy applications by eliminating unnecessary memory allocations and dynamic dispatch overhead while maintaining the original LINQ syntax.
C# developers working on performance-critical applications who use LINQ extensively and want to reduce memory allocations without rewriting their code manually.
Developers choose roslyn-linq-rewrite because it provides significant performance improvements to existing LINQ code without requiring syntax changes, offering build-time optimizations that outperform runtime solutions like LinqOptimizer.
Compiles C# code by first rewriting the syntax trees of LINQ expressions using plain procedural code, minimizing allocations and dynamic dispatch.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Rewrites LINQ expressions during compilation, not at runtime, reducing overhead without syntax changes, as shown in the decompiled output example.
Minimizes object allocations by eliminating unnecessary enumerators, delegates, and closures, evidenced by the example where only the input array is allocated.
Transforms LINQ chains into optimized for/foreach loops, achieving near-handwritten performance while maintaining LINQ's declarative syntax.
Leaves non-optimizable call chains and IQueryable intact, preventing breaks, and allows exclusions with the [NoLinqRewrite] attribute for control.
Only optimizes a subset of LINQ methods; advanced operations like GroupBy or Join are not covered, restricting its usefulness for complex queries.
Requires manual configuration with MSBuild or project.json modifications, which can be error-prone and cumbersome compared to standard compilers.
The README acknowledges bugs with Min/Max and NaN values, indicating that some edge cases might not be correctly optimized or could introduce subtle bugs.