{"id":37032654,"url":"https://github.com/zaczero/linqfasterer","last_synced_at":"2026-01-14T04:00:15.295Z","repository":{"id":40857337,"uuid":"279422051","full_name":"Zaczero/LinqFasterer","owner":"Zaczero","description":"Set of fast LINQ-like extension methods for arrays and lists. Fine-tune your code for the maximum performance.","archived":true,"fork":false,"pushed_at":"2022-06-23T11:35:47.000Z","size":1465,"stargazers_count":20,"open_issues_count":2,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-01T02:02:31.964Z","etag":null,"topics":["arrays","fast","faster","fine-tuning","linq","lists","optimization","performance"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zaczero.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-13T22:10:05.000Z","updated_at":"2025-07-15T18:31:59.000Z","dependencies_parsed_at":"2022-09-13T03:00:59.283Z","dependency_job_id":null,"html_url":"https://github.com/Zaczero/LinqFasterer","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Zaczero/LinqFasterer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zaczero%2FLinqFasterer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zaczero%2FLinqFasterer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zaczero%2FLinqFasterer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zaczero%2FLinqFasterer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zaczero","download_url":"https://codeload.github.com/Zaczero/LinqFasterer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zaczero%2FLinqFasterer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arrays","fast","faster","fine-tuning","linq","lists","optimization","performance"],"created_at":"2026-01-14T04:00:14.600Z","updated_at":"2026-01-14T04:00:15.290Z","avatar_url":"https://github.com/Zaczero.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![Logo](https://github.com/Zaczero/LinqFasterer/blob/master/resources/icon-24.png) LinqFasterer\n\n[![Travis (.com)](https://img.shields.io/travis/com/Zaczero/LinqFasterer?style=for-the-badge)](https://travis-ci.com/github/Zaczero/LinqFasterer)\n[![Codecov](https://img.shields.io/codecov/c/github/Zaczero/LinqFasterer?style=for-the-badge\u0026token=22SJNO514P)](https://codecov.io/gh/Zaczero/LinqFasterer)\n\nA set of fast LINQ-like extension methods for `Array[]`, `List\u003cT\u003e` and all other objects implementing `IList\u003cT\u003e` interface.\nLinqFasterer is designed to work well alongside LINQ, rather than to replace it completely.\nUnder the hood LinqFasterer operates solely on Array objects which grants it a significant performance advantage over Enumerable-based LINQ.\n\nPlease don't think about LinqFasterer as 1:1 replacement.\nThere are certain scenarios where the use of LINQ is still more appropriable.\nFor a short chain of LINQ methods ended with `ToArray()` or `ToList()` - LinqFasterer is usually a way to go.\nIn other cases switching to LinqFasterer may not be as beneficial or even hurt your performance.\nIt all depends on your use case.\nUse your common sense and benchmark your code if needed.\n\nTo learn more please visit the [mastering performance](#-mastering-performance) section.\n\n## 🏃‍♂️ Sample benchmark\n\n*Windows 10 64-bit, AMD Ryzen 7 2700X, .NET 5.0, Random int[]*\n\n|          Method |       N |             Mean |          Error |         StdDev | Ratio | RatioSD |\n|---------------- |-------- |-----------------:|---------------:|---------------:|------:|--------:|\n|   **MinLinq** |    **1000** |     **3,963.199 ns** |     **18.7389 ns** |     **11.1512 ns** |  **1.00** |    **0.00** |\n| MinFaster |    1000 |     2,253.335 ns |     13.7441 ns |      9.0909 ns |  0.57 |    0.00 |\n|           |         |                  |                |                |       |         |\n|   **OrderByLinq** |    **1000** |      **91,037.91 ns** |       **546.676 ns** |     **361.592 ns** |  **1.00** |\n| OrderByFaster |    1000 |       9,902.36 ns |        44.333 ns |      29.324 ns |  0.11 |\n|               |         |                   |                  |                |       |\n|   **SumLinq** |    **1000** |     **4,188.486 ns** |     **27.6469 ns** |     **18.2867 ns** |  **1.00** |\n| SumFaster |    1000 |       521.019 ns |      5.4260 ns |      3.5890 ns |  0.12 |\n|           |         |                  |                |                |       |\n|   **WhereLinq** |    **1000** |     **3,126.54 ns** |      **40.825 ns** |     **27.003 ns** |  **1.00** |    **0.00** |\n| WhereFaster |    1000 |     2,199.10 ns |      18.613 ns |     11.076 ns |  0.70 |    0.01 |\n\nA full list of benchmarks can be found in the [benchmark master file](https://github.com/Zaczero/LinqFasterer/blob/master/Benchmarks.md).\n\n---\n\n* [Features](#%EF%B8%8F-features)\n* [Installation](#%EF%B8%8F-installation)\n* [Requirements](#-requirements)\n* [Getting started](#-getting-started)\n* [Mastering performance](#-mastering-performance)\n* [Roadmap](#%EF%B8%8F-roadmap)\n* [Support me](#-support-me)\n* [Contact](#-contact)\n* [License](#-license)\n\n---\n\n## ⬆️ Features\n\n* Easy to use\n* [High code coverage](https://codecov.io/gh/Zaczero/LinqFasterer)\n* No dependencies\n* #nullable\n\n## 🌤️ Installation\n\n### Install with NuGet (recommended)\n\n`Install-Package LinqFasterer`\n\n### Install with dotnet\n\n`dotnet add PROJECT package LinqFasterer`\n\n### Install manually\n\n[Browse latest GitHub release](https://github.com/Zaczero/LinqFasterer/releases/latest)\n\n## ⚓ Requirements\n\nThis library is currently compiled in two frameworks, **.NET Standard 2.0** and **.NET 5.0**.\nWhen installing from a package manager a more appropriate version will be used.\nThe minimum .NET requirements are then as follows:\n\n* .NET 5.0\n* .NET Core 2.0\n* .NET Framework 4.6.1\n* Mono 5.4\n* Xamarin.iOS 10.14\n* Xamarin.Mac 3.8\n* Xamarin.Android 8.0\n* UWP 10.0.16299\n* Unity 2018.1\n\nCheck out this [interactive .NET Standard compatibility table](https://dotnet.microsoft.com/platform/dotnet-standard#versions).\n\n## 🏁 Getting started\n\nIt is stupid-simple to get started with LinqFasterer.\nAll the methods have a very similar if not the same structure as their LINQ-equivalents.\nIn most cases it is enough to simply append an `F` character to the method's name.\n\n### Examples\n\n* change `Min(...)` to `MinF(...)`\n* change `OrderBy(...)` to `OrderByF(...)`\n* change `Take(...)` to `TakeF(...)`\n\n```cs\n// use of LINQ, ~4200ns\nvar result1 = arrayWith1000Elements.Sum();\n\n// use of LinqFasterer, ~520ns - 88% faster\nvar result2 = arrayWith1000Elements.SumF();\n```\n\n### ⚠️ Warning\n\nSome methods will silently use an input sequence as the operating buffer **by default** to reduce memory allocations and improve performance.\nAs an example let's take the `ReverseF()` method which reverses an input sequence.\nThere are 2 ways of forcing a new sequence to be allocated and there is no performance difference between them.\nYou can use whichever version you prefer to.\n\n```cs\n// 1. by prepending .ToArrayF(true) method\nvar newArray1 = inputArray.ToArrayF(true).ReverseF();\n\n// 2. by passing forceClone: true argument\nvar newArray2 = inputArray.ReverseF(forceClone: true);\n```\n\nA full list of methods where the `forceClone` argument is applicable:\n\n* ClearF\n* ConcatF\n* DistinctF\n* ExceptF\n* FillF\n* IntersectF\n* OrderByF\n* OrderByDescendingF\n* ReverseF\n* SkipF\n* SkipLastF\n* SkipWhileF\n* SortF\n* SortDescendingF\n* TakeF\n* TakeLastF\n* TakeWhileF\n* ToArrayF\n* ToListF\n* WhereF\n\n**You don't have to remember this list** - that would be stupid and very unnecessary.\nIt is enough to follow a simple logic.\nThe `forceClone` argument is applicable on methods whose output is **guaranteed** to be of the same or smaller size than of an input sequence and the element's `Type` remains unchanged.\n\n## 📗 Mastering performance\n\n### 1) Understanding LINQ\n\nIf you know Python then it is easy to think about LINQ as generators.\nAll the operations are deferred until the very last moment and even then, only the required sequence elements are calculated.\nEverything beyond that is ignored saving on CPU ticks and increasing performance.\nAs an example, let's take a look at the following LINQ code:\n\n```cs\nvar result = input.Select(v =\u003e v * 15).Take(5).ToArray();\n```\n\nAt a first glance it looks like we multiply each element of a sequence by 15 and then we keep the 5 leading elements - wrong!\nLINQ is smart enough to figure out that a resulting sequence will be just 5 elements long.\nIt will multiply **only the first 5 elements** by 15 and ignore everything beyond.\nThe total number of multiplications is just 5 instead of `input.Length` - in contrary to what logic may tell us.\n\n### 2) Understanding LinqFasterer\n\nAs previously mentioned, LinqFasterer operates solely on Array objects.\nKnowing that, to get the most out of this library, your code should also favor a use of arrays whenever applicable.\nWhenever a non-array object is used as an input sequence it is internally casted onto a newly allocated array.\nThe following 2 lines of code are equivalent performance-wise *(notice how the input sequence is a list)*:\n\n```cs\nvar result1 = inputList.SelectF(v =\u003e v * 15);\nvar result2 = inputList.ToArrayF().SelectF(v =\u003e v * 15);\n```\n\nLet's now reconsider the same code example as in the *Understanding LINQ* section but with LinqFasterer methods used instead:\n\n```cs\nvar result = input.SelectF(v =\u003e v * 15).TakeF(5).ToArrayF();\n```\n\nThis code will work exactly as you think it will.\nAt first, multiply each element of a sequence by 15 and then resize the whole sequence to keep only the very first 5 elements.\nThat's not very optimal as in oppose to LINQ - each element of an input sequence is calculated even if it is discarded in a very next step.\nLet's rewrite this code into more LinqFasterer-friendly form:\n\n```cs\nvar result = input.TakeF(5).SelectF(v =\u003e v * 15).ToArrayF();\n```\n\nNow the first step is to discard all unnecessary elements, that is, all with index 5 or higher.\nAnd then, when the sequence is of size 5, multiply each element by 15.\nThe complexity is now equal to the one in LINQ's example.\nAnd by running a short benchmark one can see that the overall performance is even greater.\nAll it took is some basic understanding of the methods in use and the minor code modification.\n\n|                         Method |     N |          Mean |        Error |    Ratio |\n|------------------------------- |------ |--------------:|-------------:|---------:|\n|                  MasteringLinq | 50000 |     104.46 ns |     0.753 ns |     1.00 |\n|          MasteringLinqFasterer | 50000 | 143,489.55 ns | 5,960.480 ns | 1,371.13 |\n| MasteringLinqFastererRewritten | 50000 |      52.83 ns |     1.028 ns |     0.51 |\n\nWhat you should remember from all of this is that by using LinqFasterer correctly you open your code to even greater performance.\nBy removing Enumerable calculations *(LINQ)* from your code you save on CPU ticks but become more susceptible to killing overall performance with just a few lines of code.\nYou gain a greater level of control over what happens with a sequence allowing you to master performance.\nHowever, you also become fully responsible for making sure your code is well-optimized without any bottlenecks.\n\n## 🗺️ Roadmap\n\n### Release 2.2\n\n* Parallel support\n\n### Release 2.3\n\n* SIMD support\n\n### Release 2.4\n\n* SIMD+Parallel support\n\n## Footer\n\n### 📧 Contact\n\n* Email: [kamil@monicz.pl](mailto:kamil@monicz.pl)\n\n### 📃 License\n\n* [Zaczero/LinqFasterer](https://github.com/Zaczero/LinqFasterer/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaczero%2Flinqfasterer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzaczero%2Flinqfasterer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaczero%2Flinqfasterer/lists"}