3 ms·
In theory .Net 10 should make this obsolete, the headline features[1] are basically all about this. In practice, well, it's heuristics, I'm adding this to a par
by zamalek 1y ago
In theory .Net 10 should make this obsolete, the headline features[1] are basically all about this. In practice, well, it's heuristics, I'm adding this to a particularly performance sensitive project right now :)
Edit: what's also nice is that C# recognizes Linq as a contract. So long as this has the correct method names and signatures (it does), the Linq syntax will light up automatically. You can also use this trick for your own home-grown things (add Select, Join, Where, etc. overloads) if the Linq syntax is something you like.
[1]: https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-10/runtime https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotn...
- Jordanpomeroy 1y agoCould you elaborate? I don’t see anything about improving the performance of enumerator. Zlinq appears to remove the penalty of allocating enumerators on the heap to be garbage collected. The link you sent mention improvements, but I don’t see how they lead to linq avoiding heap allocations.
- giancarlostoro 1y agoNot just that but Zlinq also works across all C# environments it seems including versions embedded in game engines like Godot, Unity, .NET Standard, .NET 8 and 9.
- kevingadd 1y agoI believe they're referring to the stack allocation improvements, which would ideally allow all the LINQ temporary objects to live on the stack. I'm not sure whether it does in practice though.
- andyayers 1y agoUnfortunately, those improvements don't work for Linq. Some notes on why this is so here: https://github.com/dotnet/runtime/blob/main/docs/design/coreclr/jit/DeabstractionAndConditionalEscapeAnalysis.md#linq https://github.com/dotnet/runtime/blob/main/docs/design/core...
- zamalek 1y agoAw, I had no idea that it didn't work out. If they work that out I'd put good money on a colossal perf boost across the board.
- moomin 1y agoSelect doesn’t have to return IEnumerable. A struct that exposes the same methods will work. So allocate-free foreach is very possible.
- debugnik 1y agoBut that's what ZLinq does, not what the upcoming changes to .NET do. What's your point?