Results 1 to 3 of 3

Thread: using automake with gcc precompiled headers experiment

  1. #1
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default using automake with gcc precompiled headers experiment

    This is my "using automake with gcc precompiled headers" experiment result:

    Using the following code in Sources/[directory that contains precomp.h]/Makefile.am
    Code:
    lib_LTLIBRARIES = libclan23Core.la
    
    # Experimental precompiled file creation
    # If this does not work, remove these precomp.h.gch lines
    BUILT_SOURCES = precomp.h.gch
    precomp.h.gch: Makefile
    	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(clanCore_CXXFLAGS) $(extra_CFLAGS_clanCore) -c precomp.h -o precomp.h.gch
    CLEANFILES = precomp.h.gch
    
    libclan23Core_la_SOURCES = \
    ...
    Using "time make -j8"

    Without precompiled headers: 3m36.652s
    With precompiled headers: 3m9.320s

    This only gives a 30 seconds speed improvement.

    The filesize of Sources/Core/precomp.h.gch is 16mb
    The filesize of Sources/CSSLayout/precomp.h.gch is 44mb

    This reflects how many includes there are in precomp.h

    For interest, making "precomp.h" huge, by including all the API from the dependencies increased the compile time by 2 minutes.
    This is not surprising, since the filesize of Sources/CSSLayout/precomp.h.gch is now 108mb ... A lot of data is read in for each CSSLayout 204 source code files.

    Conclusion. The speed increase is not work the risk, of implementing this automake hack.

    Attached is the patch
    Attached Files Attached Files

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    I don't know if you updated precomp.h, but per default it actually does not really include anything in the Linux builds.

    For the maximum efficiency of the precompiled header it should include all the headers that is used by the majority of all the source files, but not any more than that. If there are too few includes in the pch it has no effect. If there are too many it spends longer time loading the pch than it takes to parse the headers without one.

    Also worth considering is that afaik the GCC precompiled header is just a 'pre-tokenized' file and not a full AST like with Visual C++. Clang supports both, so if you first persuade all Linux distros to ditch the GCC dinosaur we can get some real speed going..

  3. #3
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    I should learn to read your posts better. You already tried to experiment with what you put in the pch.

    I believe (with no actual experience) that the GCC pch files work the best if you simply create a pch file for every header in the project, although I could be wrong about that. At least if they are still those pre-tokenized files they once were. GCC then automatically notices the pch file next to the header when including and thus builds faster. A centralized PCH is more for the AST-dump model that Visual C++ uses.

Similar Threads

  1. ClanLib 2.1.1 headers and GCC -pedantic
    By rombust in forum Official ClanLib SDK Forums
    Replies: 5
    Last Post: 12-26-2009, 08:55 AM
  2. autogen.sh patch for automake 1.11
    By Vulcanius in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 07-31-2009, 10:09 AM
  3. SVN and precompiled version do both not work for me
    By fredthemonkey in forum Novashell Game Creation System
    Replies: 5
    Last Post: 08-20-2008, 04:35 AM
  4. Errors in ClanLib headers
    By mmiikkee12 in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 09-03-2007, 08:17 AM
  5. Using ClanLib with autotools (autoconf, automake, pkg-config ...)
    By LiFo2 in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 05-16-2007, 08:37 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •