Thread: MSVC 7.1 Compile time

  1. #1
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709

    MSVC 7.1 Compile time

    Is 52 seconds a usual compile time for 2,270 lines (~40 modules) of code?

    I'm just curious what people think about it. If it's a code structure thing (I recall something about design having an impact in BS' tech. FAQ) I'm not about to redesign the whole thing - I'm fine waiting.

    So it's not *that* much of a problem.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by ahluka
    Is 52 seconds a usual compile time for 2,270 lines (~40 modules) of code?
    And how many thousands of lines of code in the headers? I think this is why the precompiled headers option was added.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    I always have a bloody hard time getting those to work, so I don't bother.
    If I enable them, I add the #include statement for the PCH header but it still insists the directive is missing.

    I'm not getting into it.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    >I add the #include statement for the PCH header but it still insists the directive is missing.

    I don't believe you #include "filename.pch" -- it's handled elsewhere.

    >I'm not getting into it.

    Okay, I won't either. (Oops.)
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    That's not what I meant. (Fine, I'll get into it).

    I create stdafx.h and set it to be the precompiled header, turn on precompiled headers, #include "stdafx.h" in the .cpp files, but it still, well, insists.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  6. #6
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Are you including it at the top of your includes?

    It should be the very first line in the cpp
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  7. #7
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Yep.
    Wait, can comments come before them?
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  8. #8
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    You'd think so. Try it with and without comments to find out . . . .
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  9. #9
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    I don't want to I'm scared

    (In other words I can't from here)
    I'll do it in the morning but yeah, you'd think so.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  10. #10
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Yes, comments can come before.

    The need for it to come before any other include is because the compiler will assume everything above it to be pre-compiled, not just what's inside it.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  11. #11
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    A precompiled header typically contains the exact internal state of the compiler after completely processing it. At the point of the include, the compiler just loads that internal state. Of course, this means that any state before that is forgotten: everything before the precompiled header is effectively ignored. Unless the compiler chooses to generate an error.

    Also, it greatly depends on the type of code. Fancy templates can really cost speed and memory of the compilation process. I've had a single Boost-heavy module (~1200 lines) require 30 seconds on GCC (which is, admittedly, a slow compiler). Since this is because of headers, having more modules means reparsing the headers more often, thus the same number of lines in the modules takes far longer if split into many modules. (Which should not be a reason to sacrifice your code organization.) Add to that the process startup time for every module, and I'd say 54 seconds isn't that bad. Mozilla requires a few hours to compile, and it's rather basic C++.
    Last edited by CornedBee; 08-05-2006 at 04:08 PM.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. printing macro's at compile time
    By KIBO in forum Linux Programming
    Replies: 9
    Last Post: 06-28-2007, 08:11 AM
  2. Compile time decision...
    By Roaring_Tiger in forum C Programming
    Replies: 2
    Last Post: 10-17-2004, 02:50 AM
  3. MSVC Skipping Compile stage
    By nickname_changed in forum Windows Programming
    Replies: 1
    Last Post: 07-22-2003, 05:14 AM
  4. compile time errors!!!!
    By devour89 in forum C++ Programming
    Replies: 6
    Last Post: 11-18-2002, 05:02 PM
  5. Debugging mode selection during compile time
    By YALINI in forum C Programming
    Replies: 1
    Last Post: 09-03-2001, 09:56 AM