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 96113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:45:50+00:00 2026-05-10T23:45:50+00:00

If something is making a single-thread program take, say, 10 times as long as

  • 0

If something is making a single-thread program take, say, 10 times as long as it should, you could run a profiler on it. You could also just halt it with a ‘pause’ button, and you’ll see exactly what it’s doing.

Even if it’s only 10% slower than it should be, if you halt it more times, before long you’ll see it repeatedly doing the unnecessary thing. Usually the problem is a function call somewhere in the middle of the stack that isn’t really needed. This doesn’t measure the problem, but it sure does find it.

Edit: The objections mostly assume that you only take 1 sample. If you’re serious, take 10. Any line of code causing some percentage of wastage, like 40%, will appear on the stack on that fraction of samples, on average. Bottlenecks (in single-thread code) can’t hide from it.

EDIT: To show what I mean, many objections are of the form ‘there aren’t enough samples, so what you see could be entirely spurious’ – vague ideas about chance. But if something of any recognizable description, not just being in a routine or the routine being active, is in effect for 30% of the time, then the probability of seeing it on any given sample is 30%.

Then suppose only 10 samples are taken. The number of times the problem will be seen in 10 samples follows a binomial distribution, and the probability of seeing it 0 times is .028. The probability of seeing it 1 time is .121. For 2 times, the probability is .233, and for 3 times it is .267, after which it falls off. Since the probability of seeing it less than two times is .028 + .121 = .139, that means the probability of seeing it two or more times is 1 – .139 = .861. The general rule is if you see something you could fix on two or more samples, it is worth fixing.

In this case, the chance of seeing it in 10 samples is 86%. If you’re in the 14% who don’t see it, just take more samples until you do. (If the number of samples is increased to 20, the chance of seeing it two or more times increases to more than 99%.) So it hasn’t been precisely measured, but it has been precisely found, and it’s important to understand that it could easily be something that a profiler could not actually find, such as something involving the state of the data, not the program counter.

  • 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. 2026-05-10T23:45:50+00:00Added an answer on May 10, 2026 at 11:45 pm

    On Java servers it’s always been a neat trick to do 2-3 quick Ctrl–Breakss in a row and get 2-3 threaddumps of all running threads. Simply looking at where all the threads ‘are’ may extremely quickly pinpoint where your performance problems are.

    This technique can reveal more performance problems in 2 minutes than any other technique I know of.

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

Sidebar

Ask A Question

Stats

  • Questions 61k
  • Answers 61k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer They are passing the hex color value as decimal. E.g:… May 11, 2026 at 9:38 am
  • added an answer If you're asking if Javadoc can create external documentation, then… May 11, 2026 at 9:38 am
  • added an answer C++/CLI wrappers are definitely the best option if you are… May 11, 2026 at 9:38 am

Related Questions

If something is making a single-thread program take, say, 10 times as long as
How can I get Environnment variables and if something is missing, set the value?
If something inherits from a Serializable class, is the child class still Serializable?
I wonder if there is something like a standalone version of Visual Studio's "Immediate
i wonder if there is something similar to Sql Profiler for Sql Server Compact
I'm not sure if this is something I should do in T-SQL or not,
How does one do this? If I want to analyze how something is getting
The monthRegex regular expression always returns true, even if dateInput is something like December
I've discovered this idiom recently, and I am wondering if there is something I
On the page http://msdn.microsoft.com/en-us/library/bb202066.aspx If references something called POLL Driver V2 however this is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.