Blog Logo

LinqGen - Optimize Linq Queries using Source Generation

LinqGen is a library that optimizes Linq queries using source generation of user code. It aims to create allocation-free, specialized Linq queries per your type. The library can be installed from NuGet as both LinqGen as library and LinqGen.Generator as the source generator. For Unity, it can be installed as a git package from Unity Package Manager or via OpenUPM. LinqGen generates code to ensure zero-allocation and slightly better performance. For additional performance boost, use struct functions with IStructFunction interface. Using source generation also makes your code friendly for AOT platforms, such as Unity, which has maximum generic depth. The core library of LinqGen is much smaller than other struct linq implementations, making it an efficient solution to optimize Linq queries.