-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Array.FindAll improvements #120336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Array.FindAll improvements #120336
Conversation
…n just return the already allocated array
|
Thanks you for your contribution. The code is not performing well with best practices. Instead, just replace the |
|
Tagging subscribers to this area: @dotnet/area-system-runtime |
|
There may be more unintentional affect after rethinking. Initializing the array pool for each |
|
I found that there were room for improvement in
Array.FindAllNow a small amount of matches are stack allocated and the List is only optionally allocated.
It is always faster with less allocations.
The stack allocated size can be made bigger, but it is fixed size, so it will have a price for no-match schenarios.
InlineArray16<T>is only in .NET 10, but if this should be backported to .NET 8, we can create our local InlineMatchArrayX