Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
L

LinqFaster

> 编程语言
Open source

Linq-like extension functions for Arrays, Span<T>, and List<T> that are faster and allocate less.

760 stars0 likes2 views
WebsiteGitHub

About

Linq-like extension functions for Arrays, Span<T>, and List<T> that are faster and allocate less.

LinqFaster

UPDATE: As of .NET 9 this library is mostly unecessary, as .NET9 had made most of these optimizations part of the native LINQ library, but if you find some useful helper functions, enjoy!

A set of Linq-Like extension methods for arrays[], Span, and List that are faster and allocate less. LinqFaster is designed to work well alongside Linq, rather than replace it completely. Extension method names mirror Linq names with an extra character, e.g. SelectF. If you have code that is often doing small Linq operations and immediatelly calling ToArray() or ToList(), or you are often using Min,Max,Sum,Average,or Aggregate, LinqFaster may provide massive cpu and memory usage reductions. See the documentation section below for more details.

LinqFaster now includes all relevant Linq extension methods, and many SIMD and Parallel enhanced extension methods are available as well in separate projects and nuget packages. The projects have no dependencies on each other so you can pick and choose at will.

The base LinqFaster project is now compatible with Unity3D

Now available on Nuget

Sample Benchmarks

64bit Win 10, 2 Core I7 Mobile

Method TEST_SIZE Mean Allocated
OrderByLinq 100000 24,436.0135 us 1.2 MB
OrderByFast 100000 5,612.7712 us 802.1 kB
MinLinq 100000 548.9181 us 48 B
MinFast 100000 69.2122 us 0 B
MinFastSIMD 100000 14.5291 us 0 B
SumLinq 100000 541.3823 us 48 B
SumFast 100000 53.8166 us 0 B
SumFastSIMD 100000 9.7636 us 0 B
SumFastSIMDParallel 100000 3.7074 us 1.11 kB

More detailed info and benchmarks available in the benchmarks file which will be continually updated.

Features

  • SIMD enhanced array operations
  • :arrow_down: Execution time
  • :arrow_down: GC churn
  • :arrow_up: Battery life
  • :arrow_down: Sever farm costs
  • :arrow_down: Co2 output
  • :arrow_down: Electricity bill
  • :arrow_up: L1 cache hits
  • :arrow_up: FPS!

Documentation

  • LinqFaster
  • LinqFaster.SIMD
  • LinqFaster.Parallel
  • LinqFaster.SIMD.Parallel
  • Limitations

As well, all functions are properly documented so as to be explorable via intellisense.

LinqFaster

…

LinqFaster.SIMD

See MSDN documentation on System.Numerics.Vectors for more detail on SIMD in C#.

…

LinqFaster.Parallel

…

LinqFaster.SIMD.Parallel

See MSDN documentation on System.Numerics.Vectors for more detail on SIMD in C#.

…

Limitations

These are purely imperative implementations of the same higher order functions that Linq provides, but unlike Linq they are not lazily evaluated. This means that when chaining functions together such as:

csharp

var a = data.Where(predicate).Select(transform).Aggregate(foo);
//or
var b = data.Select(selector).Sum();

Linq would not do any work until the calls to Sum() or Aggregate(), and thus iterate over the collection only once and allocate very little. LinqFaster used this way would iterate over the collection each time and allocate much more. Sometimes the net result will still be faster overall but the better approach is to use the combined LinqFaster operations such as SelectWhere, WhereSelect, and WhereAggregate. For example the expressions above would become:

csharp

var a = data.WhereAggregate(predicate,transform,foo);
// and
var b = data.Sum(selector);

This gets you the best of both worlds. The speed of memory locality and no allocations at all. In short, think about how you are transforming your data. In some cases normal Linq may be the better choice.

While most of the functions strive to provide indentical results to Linq, the OrderBy methods are not a stable sort, while in Linq they are.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#allocationcsharp-librarygamedev-librarylinq

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言