ZLinq is a zero-allocation LINQ implementation for C# that extends standard LINQ with support for Span, SIMD operations, and tree-structured data across all .NET platforms and game engines.
Standard LINQ allocates memory with each method chain, creating performance overhead unsuitable for latency-sensitive applications like games. ZLinq solves this by using struct-based enumerables that avoid heap allocations entirely while maintaining method chaining. The implementation integrates MoveNext and Current operations to reduce iterator overhead and minimizes struct size by eliminating unnecessary state. With .NET 9 and C# 13's allows ref struct feature, the tool provides natural Span support that standard LINQ cannot offer.
Developers working on performance-critical code—particularly game developers using Unity or Godot—should consider ZLinq as a drop-in replacement for standard LINQ. The tool suits projects targeting netstandard2.0 through net9 where allocation-free iteration matters. It implements operators equivalent to .NET 10, including newer methods like Shuffle, RightJoin, LeftJoin, Sequence, and InfiniteSequence, making it useful even on older frameworks. Beyond basic LINQ, the tool includes LINQ to Tree for traversing file systems and JSON structures, and LINQ to SIMD for automatic vectorization where applicable. A source generator option can automatically accelerate existing LINQ calls without code changes.
The project passes the full System.Linq.Tests suite from dotnet/runtime, demonstrating production-grade compatibility through thousands of test cases rather than experimental implementation. Benchmark workflows run continuously to track performance across various patterns, with results showing consistent advantages over standard LINQ in both allocation and speed metrics.