5/20/2025 at 11:44:13 PM
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/dotn...
by zamalek
5/21/2025 at 12:47:15 AM
Could 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.by Jordanpomeroy
5/21/2025 at 1:12:10 AM
I 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.by kevingadd
5/21/2025 at 1:19:31 AM
Unfortunately, those improvements don't work for Linq.Some notes on why this is so here: https://github.com/dotnet/runtime/blob/main/docs/design/core...
by andyayers
5/21/2025 at 4:35:54 AM
Aw, 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.by zamalek
5/21/2025 at 1:11:49 AM
Not 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.by giancarlostoro
5/21/2025 at 5:39:44 AM
Select doesn’t have to return IEnumerable. A struct that exposes the same methods will work. So allocate-free foreach is very possible.by moomin
5/21/2025 at 6:03:36 AM
But that's what ZLinq does, not what the upcoming changes to .NET do. What's your point?by debugnik