←back to thread

201 points olvy0 | 1 comments | | HN request time: 0s | source
Show context
louthy ◴[] No.41880271[source]
"LINQ Performance improvements" really should read: "our own List<T> implementation performance improvements". Microsoft seem to spend their time improving what they need, rather than spending time on general improvements. LINQ (the syntax, not the method extensions) needs investment. Primarily around lambda allocation and potentially on compile-time reduction of lambdas.

It's time to have value-type local lambdas, or a strategy that doesn't make lambda allocation the overhead that it is. And also there really should be wildcard support (`_`) for LINQ variables by now. Which was been completely ignored when they were brought in for lambdas. It should also be possible to use a lifted-type (like IEnumerable<T>, Option<T>, etc.) as the final item in a LINQ expression, rather than `select ...`. The select adds overhead that isn't needed for certain use-cases and limits things like tail-recursive LINQ expressions.

Libraries like mine that go all-in on LINQ [1], but aren't using `IEnumerable` or `IQueryable`, or any of the LINQ extensions, continually get ignored because MS are focusing purely on improving the performance of their own projects.

A good example is the improved lambda inference. It was only brought forward because ASP.NET Core needed it for its minimal API. It seems like many of the features of the language/framework are driven by their own needs rather than those of the community. The absolute worst thing is the ever expanding set of 'magic methods' (like the LINQ extensions Select, SelectMany, and Where, but also GetAwaiter, and the rest). MS are adding capabilities for themselves (the compiler mostly) rather than do what is really needed and add proper higher-kinded traits to resolve the magic. So everything is weakly typed and only vaguely discoverable by the compiler :/

LINQ is one of those key differentiators between languages, yet it's been wallowing, pretty much untouched since C# 3. I think it's a crying shame that it has basically been ignored since then and, even now, they think LINQ is only useful for iterating lists. And primarily only their own list implementations.

/rant

Don't get me wrong, I appreciate all performance improvements, I'm sure it will help plenty of users. But the focus always seems to be narrowly targeted, which limits the potential.

[1] https://github.com/louthy/language-ext/

replies(2): >>41883339 #>>41884775 #
neonsunset ◴[] No.41883339[source]
If you do have useful feedback, please submit an issue or contribute a PR to dotnet/runtime. That’s how many performance improvements in LINQ come to be, that the post discusses.
replies(2): >>41883537 #>>41888060 #
andy81 ◴[] No.41888060[source]
The C# experience already got rug-pulled with Dev Kit.

I'm not going to spend time working for free on tools that MS charges a subscription to use.

replies(1): >>41891653 #
neonsunset ◴[] No.41891653{3}[source]
You are confusing devkit, which uses vs license, with base C# extension which is free.

Also

https://news.ycombinator.com/item?id=41884187

https://news.ycombinator.com/item?id=41809351

https://news.ycombinator.com/item?id=41639205

https://news.ycombinator.com/item?id=41384888

replies(1): >>41907245 #
1. andy81 ◴[] No.41907245{4}[source]
Nobody complaining about Dev Kit would be unaware of the base C# extension.