Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7048625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:54:52+00:00 2026-05-28T02:54:52+00:00

Do the parallel methods Parallel.For and Parallel.ForEach, internally provide their own load balancing and

  • 0

Do the parallel methods Parallel.For and Parallel.ForEach,

internally provide their own load balancing and partitioning to perform better?

If so and what circumstances do you want to write create your own Partitions using the Partitioner class to improve performance?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:54:53+00:00Added an answer on May 28, 2026 at 2:54 am

    The routines do provided their own partitioning.

    They are based on “typical” scenarios, but can occasionally require guidance, particularly in unusual situations.

    For example, the default partitioning for IEnumerable<T> implementations (that don’t implement IList<T>) will start with a small group per task, and slowly grow in size. However, if you know your IEnumerable<T> is going to slowly feed one item at a time, this will cause a block, as the Parallel class will “wait” on the next item until it receives enough elements for a partition and schedules it.

    By providing your own partitioner, you can prevent this, and get better throughput.

    Another great example of where a custom partitioner helps is if you have very small amounts of work per loop item. In this case, partitioning yourself and working on the partition avoids unnecessary overhead. This is covered in the How to: Speed Up Small Loop Bodies page on MSDN.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I like the simplicity of the Parallel.For and Parallel.ForEach extension methods in the TPL.
I'm experimenting with the new System.Threading.Parallel methods like parallel for and foreach. They seem
I'm trying to write dynamic method that calls Parallel.ForEach. I have checked a IL
I have a Parallel.ForEach loop running an intensive operation inside the body. The operation
I would like to use the new Parallel.ForEach function to loop through a datatable
I'm having a little trouble figuring out how to call the Parallel.ForEach with a
My question centers on some Parallel.ForEach code that used to work without fail, and
I am trying change from Delegates to Parallel.ForEach I see the below works fine.
Im confused with the example at http://msdn.microsoft.com/en-us/library/dd997393.aspx Parallel.ForEach<int, long>(nums, // source collection () =>
Update 2011-05-20 12:49AM: The foreach is still 25% faster than the parallel solution for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.