Slightly Faster version of Chunk #54777
Replies: 3 comments 9 replies
-
Also, is it possible to get an async version of of |
Beta Was this translation helpful? Give feedback.
-
Hi, I don't have the right to apply changes. I would suggest you have a look at Contribution to .NET Runtime. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the suggestion. We don't want to do exactly what you proposed... in particular, it severely penalizes the empty enumerable case, which with LINQ in general is fairly common, as it ends up allocating a TSource[size] unnecessarily. Similarly, it unnecessarily ends up allocating an extra TSource[size] if the enumerable isn't an exact multiple of size. That said, the core thing the above has is moving the yielding and passing-array-by-ref out of the tight loop. I've incorporated that in #54782. |
Beta Was this translation helpful? Give feedback.
-
@inputfalken -
I've written a version of
Chunk
that is slightly faster. Can you review and commit? I ran this a bunch of times and every time Mine2 is about 20μs faster.Beta Was this translation helpful? Give feedback.
All reactions