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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:22:03+00:00 2026-05-26T18:22:03+00:00

How do I find which parts of code are taking a long time to

  • 0

How do I find which parts of code are taking a long time to compile?

I am already using precompiled headers for all of my headers, and they definitely improve the compilation speed. Nevertheless, whenever I make a change to my C++ source file, compiling it takes a long time (this is CPU/memory-bound, not I/O-bound — it’s all cached). Furthermore, this is not related to the linking portion, just the compilation portion.

I’ve tried turning on /showIncludes, but of course, since I’m using precompiled headers, nothing is getting included after stdafx.h. So I know it’s only the source code that takes a while to compile, but I don’t know what part of it.

I’ve also tried doing a minimal build, but it doesn’t help. Neither does /MP, because it’s a single source file anyway.

I could try dissecting the source code and figuring out which part is a bottleneck by adding/removing it, but that’s a pain and doesn’t scale. Furthermore, it’s hard to remove something and still let the code compile — error messages, if any, come back almost immediately.

Is there a better way to figure out what’s slowing down the compilation?

Or, if there isn’t a way: are there any language constructs (e.g. templates?) that take a lot longer to compile?


What I have in my C++ source code:

  • Three (relatively large) ATL dialog classes (including the definitions/logic).

    They could very well be the cause, but they are the core part of the program anyway, so obviously they need to be recompiled whenever I change them.

  • Random one-line (or similarly small) utility functions, e.g. a byte-array-to-hex converter

  • References to (inline) classes found inside my header files. (One of the header files is gigantic, but it uses templates only minimally, and of course it’s precompiled. The other one is the TR1 regex — it’s huge, but it’s barely used.)

Note:

I’m looking for techniques that I can apply more generally in figuring out the cause of these issues, not specific recommendations for my very particular situation. Hopefully that would be more useful to other people as well.

  • 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-26T18:22:04+00:00Added an answer on May 26, 2026 at 6:22 pm

    Two general ways to improve the compilation time :

    • instead of including headers in headers, use forward declare (include headers only in the source files)
    • minimize templated code (if you can avoid using templates)

    Only these two rules will greatly improve your build time.

    You can find more tricks in “Large-Scale C++ Software Design” by Lakos.

    For visual studio (I am not sure if it is too old), take a look into this : How should I detect unnecessary #include files in a large C++ project?

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

Sidebar

Related Questions

I'm having problems with a third-party program which is using FindWindow() to find if
I need to find out what ports are attached to which processes on a
I'm interested to find which way of creating box shadows with css is most
How do you find which SPs are declared WITH RECOMPILE, either in INFORMATION_SCHEMA, sys.objects
I want to find which tables are related to a specific table. I can
I need to find which event handlers are registered over an object. For example:
The objectve is to find which Serial port is phyisically connected to other machine.
The Adobe docs (I can't find which) state that Flash can read Shared Objects
I'm having trouble composing a CakePHP find() which returns the records I'm looking for.
I have scoured the internet to find which CMS's run on CloudSites and the

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.