VeloLinq 0.1.1
dotnet add package VeloLinq --version 0.1.1
NuGet\Install-Package VeloLinq -Version 0.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VeloLinq" Version="0.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VeloLinq" Version="0.1.1" />
<PackageReference Include="VeloLinq" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add VeloLinq --version 0.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: VeloLinq, 0.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package VeloLinq@0.1.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=VeloLinq&version=0.1.1
#tool nuget:?package=VeloLinq&version=0.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
VeloLinq
VeloLinq is a high-performance, low-allocation LINQ to Objects library for .NET 11, built on value-type (struct / ref struct) sequences, struct enumerators, and structural metadata (SequenceInfo).
- Current: Full
System.Linq.EnumerableAPI parity forT[],List<T>,IEnumerable<T>,IEnumerable,ReadOnlySpan<T>, and sequence factories (Range,Repeat,Empty,Sequence,InfiniteSequence). - Planned: Parallel LINQ and SIMD-accelerated numeric terminals.
Quick Start
using VeloLinq.Extensions;
int[] numbers = [1, 2, 3, 4, 5, 6];
int[] result = numbers
.AsVelo()
.Where(n => n % 2 == 0)
.Select(n => n * 10)
.ToArray(); // [20, 40, 60]
Zero-Allocation Struct Functors
Implement IPredicate<T> and ISelector<T, TResult> as readonly structs on hot paths so the JIT can inline them without delegate overhead:
using VeloLinq.Extensions;
using VeloLinq.Interfaces;
using VeloLinq.Structures.Abstractions;
public readonly struct IsEven : IPredicate<int>
{
public bool Invoke(int value) => value % 2 == 0;
}
public readonly struct MultiplyByTen : ISelector<int, int>
{
public int Invoke(int value) => value * 10;
}
int sum = numbers
.AsVelo()
.Where(new IsEven())
.Select(VeloSelector.Create<int, int, MultiplyByTen>(new MultiplyByTen()))
.Sum(); // 120
ReadOnlySpan<T> Pipelines
ReadOnlySpan<int> span = stackalloc int[] { 1, 2, 3, 4, 5, 6 };
int evenSum = span
.AsVelo()
.Where(n => n % 2 == 0)
.Select(n => n * 2)
.Sum(); // 24
Grouping, Keyed Aggregations & Outer Joins
var counts = sales.AsVelo().CountBy(s => s.Department).ToArray();
var totals = sales.AsVelo().AggregateBy(s => s.Department, 0m, (acc, s) => acc + s.Amount).ToArray();
var leftRows = customers
.AsVelo()
.LeftJoin(orders, c => c.Id, o => o.CustomerId)
.Select(m => new { Customer = m.Outer.Name, OrderId = m.Inner?.Id })
.ToArray();
IEnumerable<T> Interop
IEnumerable<int> deferred = numbers.AsVelo().Where(n => n > 3).AsEnumerable();
Benchmark Highlights (N = 100,000, ShortRun, .NET 11)
| Scenario | System.Linq | VeloLinq | Speedup | Allocated (Sys / Velo) |
|---|---|---|---|---|
Select + Sum |
216,920 ns | 47,010 ns | 4.61× | 48 B / 0 B |
Zip |
509,222 ns | 100,011 ns | 5.09× | 160 B / 0 B |
Zip (3 sequences) |
1,143,290 ns | 423,902 ns | 2.70× | 208 B / 0 B |
OfType<T> |
434,307 ns | 98,380 ns | 4.41× | 80 B / 0 B |
Cast<T> |
335,872 ns | 94,775 ns | 3.54× | 80 B / 0 B |
Index |
883,519 ns | 325,010 ns | 2.72× | 96 B / 0 B |
Skip + Take + Sum |
256.8 ns | 104.7 ns | 2.45× | 96 B / 0 B |
DistinctBy |
562,914 ns | 268,874 ns | 2.09× | 6,024 B / 6,000 B |
Join |
845.1 ms | 555.9 ms | 1.52× | 1,587.7 KB / 1,591.5 KB |
SkipLast (SequenceInfo) |
343,078 ns | 2.05 ns | O(1) | 136 B / 0 B |
SortedMin (SequenceInfo) |
3,917 ns | 1.77 ns | O(1) | 0 B / 0 B |
Full documentation, examples, and benchmark suite: github.com/MsiGrib/VeloLinq.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net11.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.