Can LINQ be slightly more optimal? Would it be a huge burden for the compiler? #70599
-
This:
turns into:
yet it could be just:
This:
turns into:
While if it were:
there would be fewer allocations. This:
becomes:
and could be:
When And one more:
is compiled as:
Why not:
In most cases I prefer extension methods to LINQ, but for complex queries LINQ can be better for readability, Hence, I'd like to understand, how difficult it is to make such optimizations. |
Beta Was this translation helpful? Give feedback.
Answered by
huoyaoyuan
Nov 7, 2023
Replies: 1 comment
Answer selected by
voroninp
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See dotnet/csharplang#2482