Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add fast paths to WhenAny(IEnumerable) #38896

Merged
merged 2 commits into from
Oct 11, 2020
Merged

Conversation

Bond-009
Copy link
Contributor

@Bond-009 Bond-009 commented Jul 7, 2020

Adds fast paths in case tasks is an array or an ICollection

Fixes #26695

Adds fast paths in case `tasks` is an array or an `ICollection`
@dnfadmin
Copy link

dnfadmin commented Jul 7, 2020

CLA assistant check
All CLA requirements met.

@Wraith2
Copy link
Contributor

Wraith2 commented Jul 7, 2020

Can you provide BenchmarkDotnet numbers showing the performance increase please?

@Bond-009
Copy link
Contributor Author

Bond-009 commented Jul 8, 2020

I could, any guides on how to do this on linux?
IMHO, they shouldn't be needed.

  1. This is almost exactly the same code as WhenAll(IEnumerable)
  2. It prevents multiple allocations from the growing list in case the collection is an Array or an ICollection

@Wraith2
Copy link
Contributor

Wraith2 commented Jul 8, 2020

https://benchmarkdotnet.org/ works on Linux just as well as windows. Just follow the docs.
Proof is almost always required for performance related changes because even though it may look like something is better it can make them worse. There is a performance repo tracking the perf of the runtime and bcl at https://github.com/dotnet/performance which may already have some benchmarks you can use.

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@stephentoub stephentoub reopened this Sep 14, 2020
@danmoseley
Copy link
Member

Unrelated crypto failure, too old now for an issue?

@danmoseley danmoseley merged commit 9321d39 into dotnet:master Oct 11, 2020
@Bond-009 Bond-009 deleted the issue-26695 branch October 11, 2020 11:17
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Task.WhenAny(IEnumerable) should test for ICollection
6 participants