Faslinq
October 4, 2021 ยท View on GitHub
High-Performance Linq-Like extension methods for arrays and List
This is nowhere near ready for production, but I was recently reading about how Linq does allocations all over the places as well as multiple enumerations and that marshalling List
I also was thinking about typical use cases, such as Where().Select()[.Take()] chains that are so common and created new "combo" extension methods like SelectWhere, SelectTake, SelectWhereTake, etc that use a single loop to do all the work.
List<TData> data = GetFromSource<TData>();
var result = data.Where(d => d.Prop1 == 1).Select(d => (d.Prop1, d.Prop2)).Take(10).ToList();
// becomes
var result = data.SelectWhereTake(10, d => d.Prop1 == 1, d => (d.Prop1, d.Prop2));