# cysharp/zlinq

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/cysharp-zlinq).**

4,935 stars · 203 forks · C# · mit

## Links

- GitHub: https://github.com/Cysharp/ZLinq
- awesome-repositories: https://awesome-repositories.com/repository/cysharp-zlinq.md

## Topics

`c-sharp` `linq` `unity`

## Description

ZLinq is a zero-allocation LINQ library and memory-efficient collection toolkit for C#. It provides a high-performance replacement for standard query operations by using value-type enumerators and pooled memory to eliminate heap allocations and reduce garbage collection overhead.

The library features a C# source generator that automatically routes standard query method calls to these zero-allocation implementations. It further accelerates data processing through a SIMD accelerated data library, using hardware vectorization for numeric aggregations and bulk operations on primitive arrays and spans.

Beyond linear collections, the toolkit includes a hierarchical data query tool for traversing tree-like structures such as JSON nodes, file systems, and scene graphs using axis-based traversal. It also covers memory management strategies including shared array renting and buffer-based result copying to maintain execution speed in memory-constrained environments.

## Tags

### Software Engineering & Architecture

- [Value-Type Enumerator Patterns](https://awesome-repositories.com/f/software-engineering-architecture/value-type-enumerator-patterns.md) — Avoids heap allocations by implementing query logic within structs that are passed by value.
- [Zero-Allocation Data Processing](https://awesome-repositories.com/f/software-engineering-architecture/zero-allocation-data-processing.md) — Provides high-performance data processing using value-type enumerators to eliminate heap allocations in memory-constrained environments.
- [Pooled Array Materialization](https://awesome-repositories.com/f/software-engineering-architecture/shared-memory-management/pooled-array-materialization.md) — Materializes results into arrays from a shared pool to minimize memory pressure and garbage collection. ([source](https://github.com/Cysharp/ZLinq#readme))
- [Zero-Allocation LINQ Implementations](https://awesome-repositories.com/f/software-engineering-architecture/zero-allocation-linq-implementations.md) — Provides a zero-allocation replacement for standard LINQ using value-type enumerators.
- [Array Materialization Pooling](https://awesome-repositories.com/f/software-engineering-architecture/byte-buffer-pooling/array-materialization-pooling.md) — Rents temporary buffers from a shared memory pool to store query results instead of allocating new arrays.
- [Custom Query Operators](https://awesome-repositories.com/f/software-engineering-architecture/custom-query-operators.md) — Allows the implementation of user-defined query operators through enumerator structs for efficient item retrieval. ([source](https://github.com/Cysharp/ZLinq/blob/main/README.md))
- [Zero-Copy Buffers](https://awesome-repositories.com/f/software-engineering-architecture/zero-copy-buffers.md) — Transfers processed elements directly into existing buffers to avoid allocating new return collections. ([source](https://github.com/Cysharp/ZLinq#readme))
- [Buffer-Copy Transfers](https://awesome-repositories.com/f/software-engineering-architecture/zero-copy-buffers/buffer-copy-transfers.md) — Copies processed elements directly into existing memory spans to eliminate return collection allocations.

### Data & Databases

- [SIMD-Accelerated Data Processors](https://awesome-repositories.com/f/data-databases/data-engineering-infrastructure/data-extraction-ingestion/data-parsing/simd-parsers/simd-accelerated-data-processors.md) — Utilizes wide CPU registers to maximize throughput during numeric aggregations and bulk processing.
- [Hierarchical Querying](https://awesome-repositories.com/f/data-databases/hierarchical-data-models/hierarchical-querying.md) — Provides specialized operators for traversing tree-like structures including JSON nodes, file systems, and scene graphs. ([source](https://github.com/Cysharp/ZLinq#readme))
- [Value-Type Enumerators](https://awesome-repositories.com/f/data-databases/key-value-pair-managers/enumerable-mappings/value-type-enumerators.md) — Transforms arrays and lists into value enumerables to support chaining operations without creating new objects. ([source](https://github.com/Cysharp/ZLinq#readme))
- [SIMD-Accelerated Arithmetic](https://awesome-repositories.com/f/data-databases/vectorized-arithmetic/simd-accelerated-arithmetic.md) — Utilizes processor-specific SIMD vector instructions to accelerate numeric aggregations and primitive processing.
- [JSON Restructurings](https://awesome-repositories.com/f/data-databases/custom-type-converters/json-converters/json-restructurings.md) — Provides logic operators to filter nested JSON data structures and extract specific values. ([source](https://github.com/Cysharp/ZLinq/blob/main/README.md))
- [Numeric Aggregations](https://awesome-repositories.com/f/data-databases/hardware-acceleration/numeric-aggregations.md) — Calculates sums and averages using hardware acceleration to increase throughput for primitive types. ([source](https://github.com/Cysharp/ZLinq/blob/main/README.md))
- [Value-Based Enumerator Definitions](https://awesome-repositories.com/f/data-databases/in-memory-collection-paging/lazy-enumeration-patterns/value-based-enumerator-definitions.md) — Supports defining specialized data traversal logic using a value-based enumerator pattern to prevent memory allocations. ([source](https://github.com/Cysharp/ZLinq/blob/main/CLAUDE.md))
- [Object Hierarchy Navigation](https://awesome-repositories.com/f/data-databases/recursive-structure-processors/recursive-structure-traversers/object-hierarchy-navigation.md) — Navigates parent-child relationships in scene graphs and object trees to find ancestors and descendants. ([source](https://github.com/Cysharp/ZLinq/blob/main/CLAUDE.md))
- [Axis-Based Hierarchy Traversal](https://awesome-repositories.com/f/data-databases/recursive-structure-processors/recursive-structure-traversers/object-hierarchy-navigation/axis-based-hierarchy-traversal.md) — Implements specialized enumerators for navigating ancestor and descendant relationships in tree-like structures.
- [Vectorized Data Processing](https://awesome-repositories.com/f/data-databases/vectorized-data-processing.md) — Processes array and span elements using hardware vector widths via lambda expressions for high-performance iteration. ([source](https://github.com/Cysharp/ZLinq#readme))
- [File System Hierarchy Querying](https://awesome-repositories.com/f/data-databases/virtual-table-querying/external-table-querying/file-system-hierarchy-querying.md) — Enables directory and file traversal using specialized operators to locate ancestors, children, and descendants. ([source](https://github.com/Cysharp/ZLinq/blob/main/README.md))

### Operating Systems & Systems Programming

- [Array Renting Pools](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/allocation-strategies/dynamic-memory-allocation/custom-memory-allocators/preallocated-memory-pools/fixed-size-memory-pool-managers/fixed-pool-allocators/subsystem-memory-pools/array-renting-pools.md) — Stores query results in arrays rented from a shared pool to avoid frequent memory allocations. ([source](https://github.com/Cysharp/ZLinq/blob/main/README.md))
- [Zero-Allocation Conversions](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/allocation-strategies/dynamic-memory-allocation/zero-allocation-conversions.md) — Executes data transformations without triggering heap allocations to reduce the frequency of garbage collection. ([source](https://github.com/Cysharp/ZLinq/blob/main/opensource.snk))
- [Managed Memory Allocators](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/allocation-strategies/dynamic-memory-allocation/custom-memory-allocators/managed-memory-allocators.md) — Uses value-type enumerators to remove heap allocations typically caused by standard query operations. ([source](https://github.com/Cysharp/ZLinq#readme))
- [Vectorized Loop Processing](https://awesome-repositories.com/f/operating-systems-systems-programming/vectorized-loop-processing.md) — Applies transformations to arrays and spans using hardware vector widths to process elements in bulk. ([source](https://github.com/Cysharp/ZLinq/blob/main/README.md))

### Programming Languages & Runtimes

- [Direct Method Call Generation](https://awesome-repositories.com/f/programming-languages-runtimes/direct-method-call-generation.md) — Generates direct method calls via a source generator to bypass standard LINQ overhead and improve execution speed. ([source](https://github.com/Cysharp/ZLinq#readme))
- [Compile-Time Method Routing](https://awesome-repositories.com/f/programming-languages-runtimes/direct-method-call-generation/compile-time-method-routing.md) — Uses a C# source generator to automatically route standard query method calls to zero-allocation implementations.
- [Zero-Allocation LINQ Implementations](https://awesome-repositories.com/f/programming-languages-runtimes/language-integrated-query-linq/zero-allocation-linq-implementations.md) — Performs data transformations and filtering using LINQ without creating heap allocations to reduce garbage collection overhead.
- [Memory-Efficient Collection Toolkits](https://awesome-repositories.com/f/programming-languages-runtimes/memory-efficient-collection-toolkits.md) — Offers a memory-efficient toolkit for processing arrays and spans using pooled memory and value enumerators.
- [C Source Generators](https://awesome-repositories.com/f/programming-languages-runtimes/c-source-generators.md) — Uses a C# source generator to automatically route standard LINQ calls to zero-allocation implementations.
- [High-Performance Method Replacements](https://awesome-repositories.com/f/programming-languages-runtimes/extension-methods/high-performance-method-replacements.md) — Enables swapping standard query methods for high-performance alternatives via assembly-level configuration settings. ([source](https://github.com/Cysharp/ZLinq/blob/main/CLAUDE.md))
- [Memory Spans](https://awesome-repositories.com/f/programming-languages-runtimes/memory-spans.md) — Processes contiguous blocks of memory using type-safe views to optimize performance and reduce allocations. ([source](https://github.com/Cysharp/ZLinq/blob/main/CLAUDE.md))

### Scientific & Mathematical Computing

- [Hardware-Level Vectorization](https://awesome-repositories.com/f/scientific-mathematical-computing/hardware-level-vectorization.md) — Accelerates mathematical and logical operations using hardware-level vectorization for supported primitive types. ([source](https://github.com/Cysharp/ZLinq#readme))

### Part of an Awesome List

- [GC Reduction Strategies](https://awesome-repositories.com/f/awesome-lists/devtools/memory-allocation/gc-reduction-strategies.md) — Reduces garbage collection frequency and overhead by performing data queries without heap memory allocation. ([source](https://github.com/Cysharp/ZLinq/blob/main/ZLinq.slnx))

### Education & Learning Resources

- [Tree Traversal Utilities](https://awesome-repositories.com/f/education-learning-resources/technical-domain-education/technical-academic-domains/algorithmic-design-analysis/tree-data-structures/tree-traversal-utilities.md) — Provides utilities for efficiently navigating and retrieving nodes within hierarchical structures like JSON or file systems.

### Graphics & Multimedia

- [Scene Graph Hierarchy Querying](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/scene-management-systems/object-hierarchy-management/scene-graph-hierarchy-querying.md) — Navigates parent and child relationships within a scene graph to locate specific components or objects. ([source](https://github.com/Cysharp/ZLinq/blob/main/README.md))
