tricks to organize code for faster compile

Discussion in 'C++' started by Greger, Aug 13, 2005.

  1. Greger

    Greger Guest

    Dear all,
    what do you people use for organising code for optimal compile time?
    I have an app , gui + core + file ops, which is growing and compile time is
    too long, need a better way of organising the code. Could someone please
    highlight what could be done to speed up compile time, tia.
    Greger
    --
    http://www.gregerhaga.net
    Greger, Aug 13, 2005
    #1
    1. Advertising

  2. Greger wrote:
    > what do you people use for organising code for optimal compile time?


    The simplest "trick" I use is forward-declaring all that can be instead
    of defining.

    > I have an app , gui + core + file ops, which is growing and compile
    > time is too long, need a better way of organising the code. Could
    > someone please highlight what could be done to speed up compile time,
    > tia.


    Splitting your code into components and building them separately should
    also help. See John Lakos' "Large-Scale C++ Software Design" for more
    information on separating your code into components.

    V
    Victor Bazarov, Aug 13, 2005
    #2
    1. Advertising

  3. Greger

    Mirek Fidler Guest

    Greger wrote:
    > Dear all,
    > what do you people use for organising code for optimal compile time?
    > I have an app , gui + core + file ops, which is growing and compile time is
    > too long, need a better way of organising the code. Could someone please
    > highlight what could be done to speed up compile time, tia.
    > Greger


    U++ (upp.sf.net) provides build technology (blitz-build) that in most
    cases reduces build time 4-8 times.

    It works by grouping .cpp files together and compiling them as single
    unit. This way included files are processed just once. As C++ compiler
    spends most time parsing headers (usually it is hunderds of thousands .h
    lines and thousands of .cpp lines), compile time reductions are really
    dramatic.

    Of course, it needs more magic to work than can be explained in a single
    post :)

    Mirek
    Mirek Fidler, Aug 13, 2005
    #3
  4. On Sat, 13 Aug 2005 12:36:24 +0200, Greger
    <> wrote:

    >Dear all,
    >what do you people use for organising code for optimal compile time?
    >I have an app , gui + core + file ops, which is growing and compile time is
    >too long, need a better way of organising the code. Could someone please
    >highlight what could be done to speed up compile time, tia.
    >Greger


    What Victor and Mirek said, but also use precompiled headers if you
    can.

    --
    Bob Hairgrove
    Bob Hairgrove, Aug 14, 2005
    #4
  5. "Greger" <> wrote in message
    news:ddka3d$q0h$...
    > Dear all,
    > what do you people use for organising code for optimal compile time?
    > I have an app , gui + core + file ops, which is growing and compile

    time is
    > too long, need a better way of organising the code. Could someone

    please
    > highlight what could be done to speed up compile time, tia.


    Avoid networked drives, especially for intermediate files.

    --
    Regards,

    Joe Hotchkiss,
    http://joe.hotchkiss.com
    http://harrowsubaqua.org.uk

    XXXXXXXXXXXXXXXXXXXXXXXXX
    X joe.hotchkiss X
    X at selex-sas.com X
    XXXXXXXXXXXXXXXXXXXXXXXXX
    Joe Hotchkiss, Aug 15, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tian
    Replies:
    2
    Views:
    429
    Steven Bethard
    Mar 28, 2005
  2. Nagaraj
    Replies:
    1
    Views:
    840
    Lionel B
    Mar 1, 2007
  3. Larry Bud

    How Do you Organize your Code?

    Larry Bud, Jul 13, 2007, in forum: ASP .Net
    Replies:
    6
    Views:
    381
    Mark Rae [MVP]
    Jul 13, 2007
  4. Replies:
    8
    Views:
    373
    Bruno Desthuilliers
    Jul 20, 2007
  5. Alex314

    Organize class source code

    Alex314, May 27, 2008, in forum: Java
    Replies:
    8
    Views:
    1,145
    Alex314
    May 28, 2008
Loading...

Share This Page