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

  • SEARCH
  • Home
  • 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 8401873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:54:49+00:00 2026-06-09T21:54:49+00:00

I am investigating for how many time it takes for a particular operation to

  • 0

I am investigating for how many time it takes for a particular operation to complete. The operation is like the following:

Parallel.ForEach(items, item => SaveScheme(item));

The SaveScheme method works with a database: executes some queries and works with the information. The amount of elements in items collection can be big enough.

When I run this operation, it takes about 20-40 seconds to complete. But when I run it with a profiling turned on, it takes only 3 seconds!

I didn’t find any information about this problem. My only guess is that with profiling Parallel.ForEach creates more threads than without it, but I don’t know for sure, and even if it’s true, I don’t know what to do with it.

So, why is that happens and how can I archieve this performance when I run the application without profiling?


UPD. Parallel has nothing to do with this: I tested with simple foreach instead and the operation still completes in 3 seconds!

  • 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-06-09T21:54:50+00:00Added an answer on June 9, 2026 at 9:54 pm

    I found the answer:

    The reason is because when you run your application within Visual
    Studio, the debugger is attached to it. When you run it using the
    profiler, the debugger is not attached.

    If you try running the .exe by itself, or running the program through
    the IDE with “Debug > Start Without Debugging” (or just press Ctrl+F5)
    the application should run as fast as it does with the profiler.

    https://stackoverflow.com/a/6629040/1563172

    I didn’t find it earlier because I thought that the reason is concurrency.

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

Sidebar

Related Questions

I was investigating the slowness of proxy initialization (PrivateInvoke method) and found that many
While investigating google plusone scripts, I've seen following syntax many times: (0, _.Em)(); Assuming
We are investigating the Entity Framework to see if it will meet our particular
recent years, we have used CUDA for time-critical tasks within many of our 64-bit
Been investigating for a while now and keep hitting a brick wall. I am
While investigating an issue with application I'm working on, I've came across one behavior
I am currently investigating matlab and especially the matlab coder. My understanding is that
I'm investigating if it is possible to send three different Ax 2009 reports to
I am investigating a way to use bamboo to distribute complex environment changes to
I am investigating since a few hours the best way to use the Email

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.