You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Parallel.ForEach should not be used for IO bound tasks. #22232
Hi @jvanlangen - I agree, the example should be CPU bound and not IO. I'm updating this to be an "up for grabs", feel free to create a pull request changing this and I'll happily review it. Otherwise, I'll try to get to it. Thanks again
@IEvangelist - I agree given example is misleading.
I would love to give it a shot to fix this.
Let me know your views on the following proposals.
Objective : Showcase the power of Parallel.ForEach for CPU intensive operations.
Proposal : We pick up a CPU intensive operation let's say crude way to Findout if given number is prime or not. We start with fix size collection of random integer. In scenario 1 we can iterate over a collection with Foreach and in scenario 2 we iterate with Parallel.Foreach. In the end we display total number of prime numbers and time taken by both the scenarios.
Do let me know perspective or any other thoughts ?
Activity
IEvangelist commentedon Jan 5, 2021
Hi @jvanlangen - I agree, the example should be CPU bound and not IO. I'm updating this to be an "up for grabs", feel free to create a pull request changing this and I'll happily review it. Otherwise, I'll try to get to it. Thanks again
surenderssm commentedon Feb 12, 2021
@IEvangelist - I agree given example is misleading.
I would love to give it a shot to fix this.
Let me know your views on the following proposals.
Objective : Showcase the power of Parallel.ForEach for CPU intensive operations.
Proposal : We pick up a CPU intensive operation let's say crude way to Findout if given number is prime or not. We start with fix size collection of random integer. In scenario 1 we can iterate over a collection with Foreach and in scenario 2 we iterate with Parallel.Foreach. In the end we display total number of prime numbers and time taken by both the scenarios.
Do let me know perspective or any other thoughts ?
IEvangelist commentedon Feb 12, 2021
Hi @surenderssm - I like that idea, and look forward to a PR.
surenderssm commentedon Feb 15, 2021
Thanks @IEvangelist - Will share the PR asap.