All Projects → ndrwrbgs → FastLinq

ndrwrbgs / FastLinq

Licence: Apache-2.0 license
Drop-in-place Memory and Performance optimizations for LINQ

Programming Languages

C#
18002 projects
HTML
75241 projects
Batchfile
5799 projects

Projects that are alternatives of or similar to FastLinq

LinqBuilder
LinqBuilder is an advanced implementation of the specification pattern specifically targeting LINQ query generation.
Stars: ✭ 34 (+54.55%)
Mutual labels:  linq
dontasq
⚡🐍 Extends built-in Python collections with LINQ-style methods
Stars: ✭ 31 (+40.91%)
Mutual labels:  linq
computation-expressions-workshop
F# Computation Expressions Workshop
Stars: ✭ 58 (+163.64%)
Mutual labels:  linq
Linq.Expression.Optimizer
System.Linq.Expression expressions optimizer. http://thorium.github.io/Linq.Expression.Optimizer
Stars: ✭ 81 (+268.18%)
Mutual labels:  linq
multiplex.js
LINQ for JavaScript.
Stars: ✭ 79 (+259.09%)
Mutual labels:  linq
DynamicQueryable
λ Construct Linq queries using strings.
Stars: ✭ 46 (+109.09%)
Mutual labels:  linq
OLGA
an Ontology SDK
Stars: ✭ 36 (+63.64%)
Mutual labels:  linq
EFSqlTranslator
A standalone linq to sql translator that can be used with EF and Dapper.
Stars: ✭ 51 (+131.82%)
Mutual labels:  linq
linq-fns
👴 LINQ for Javascript, written by TypeScript
Stars: ✭ 74 (+236.36%)
Mutual labels:  linq
linq
LINQ to Objects for Java.
Stars: ✭ 151 (+586.36%)
Mutual labels:  linq
Kendo.DynamicLinqCore
KendoNET.DynamicLinq implements server paging, filtering, sorting, grouping, and aggregating to Kendo UI via Dynamic Linq for .Net Core App(1.x ~ 3.x).
Stars: ✭ 36 (+63.64%)
Mutual labels:  linq
linq2db.LINQPad
linq2db.LINQPad is a driver for LINQPad.
Stars: ✭ 65 (+195.45%)
Mutual labels:  linq
QuickDAO
Simple Data Access Object library with LinQ and multiengine support for (Windows,Linux,OSX/IOS/Android) and freepascal (Windows/Linux)
Stars: ✭ 49 (+122.73%)
Mutual labels:  linq
python-linq-samples
Python Linq Examples: Comparision of C# Linq functional programming to Python
Stars: ✭ 69 (+213.64%)
Mutual labels:  linq
PropertyTranslator
Translates computed properties in LINQ queries into their implementation (based on Microsoft.Linq.Translations).
Stars: ✭ 14 (-36.36%)
Mutual labels:  linq
Linq.ts
linq for typescript
Stars: ✭ 33 (+50%)
Mutual labels:  linq
SoftUni-Software-Engineering
SoftUni- Software Engineering
Stars: ✭ 47 (+113.64%)
Mutual labels:  linq
Gridify
Easy and optimized way to apply Filtering, Sorting, and Pagination using text-based data.
Stars: ✭ 372 (+1590.91%)
Mutual labels:  linq
LinqBenchmarks
Benchmarking LINQ and alternative implementations
Stars: ✭ 138 (+527.27%)
Mutual labels:  linq
linq4c
LINQ for C(GroupBy, GroupJoin, Join, Take, Where, Select, etc)
Stars: ✭ 39 (+77.27%)
Mutual labels:  linq

1/1/2021 Update

I'm moving on from this project and contribution to other projects in its place.

Please see https://github.com/NetFabric/LinqBenchmarks for great libraries achieving the same goals, and their relative performances. There are trade-offs in various implementations, and by comparing your scenario to the benchmarks across libraries you can optimize for your scenario.

FastLinq

This library optimizes on top of LINQ by avoiding loss of information. Many of LINQ's methods can be better implemented against ICollection or IList, and indeed in many cases LINQ itself does these optimizations. Unfortunately, it typically only does them when the original input was ICollection/IList and that information is lost as soon as you call a LINQ method and get back IEnumerable -- making method chaining sub-optimal.

This library achieves better performance by staying within the ICollection/IList types where possible.

Later goals for it will include optimizing memory allocations to avoid them where not absolutely necessary and optimizations for List/Array. Potential late-stage work will include information-GAIN opportunities (where the result of a LINQ method on IEnumerable is known to have more characteristics than just IEnumerable [max/min length]) and a try-it-out library that can be dropped in place to measure the impact that will be achieved by using this library.

Improved methods

These methods can be improved from having Collection/List information

  • All
  • Any
  • Count
  • DefaultIfEmpty
  • ElementAt
  • ElementAtOrDefault
  • Skip
  • Take
  • ToArray
  • ToDictionary
  • ToList

Other methods are implemented also to preserve information lost today (e.g. Take(ICollection, int) -> the exact count can be known). By preserving these methods, the above improved methods can apply more broadly (e.g. if we did not add information-preservation methods, then ElementAt could only optmize if it's immediate predecessor were an IList, however if Skip maintains IList information, then ElementAt can be optimized in more scenarios).

* Most of these 'information preservation' methods have a small overhead. Though the overhead pays for itself when you use any method in the list above.

Sample Performance gains

RealWorldBenchmark.cs has some LINQ usage scenarios scraped from an existing code base.

Scenario BCL ns FastLinq ns Δ ns %Δ ns BCL B FastLinq B Δ B %Δ B
Get the 2nd to last item from collection 153 205 +52* +34%* 208 272 +64 +31%†
Get the 2nd to last item from array 201 67 -134 -67% 552 56 -496 -90%
Lazy select a field in existing list 40 9 -31 -78% 80 32 -48 -60%
"" and enumerate the result 315 367 +52* +17%* 80 80 0 0%
"" and materialize a list 688 489 -199 -29% 456 248 -208 -46%
Lazy get last 10 items from existing list 38 26 -12 -32% 192 80 -112 -58%
"" and enumerate the result 628 315 -313 -50% 800 120 -680 -85%
"" and materialize a list 764 401 -363 -48% 1024 224 -800 -78%
Lazy simple pagination 28 32 +4* +14%* 128 64 -64 -50%
"" and enumerate the result 298 61 -237 -80% 168 112 -56 -33%
"" and materialize a list 339 108 -231 -68% 208 152 -56 -27%

* Note that this case is not one that can be optimized, and shows overhead

† though the amount of memory overhead is being investigated

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].