LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-20-2005, 03:24 PM   #1
ripat
LQ Newbie
 
Registered: Aug 2003
Distribution: Mandrake 9.2
Posts: 22

Rep: Reputation: 15
ccache, precompiled headers & C++ - Doesn't work as well as imagined


Hi, I recently tried to decrease the compile times for a C++ project of mine. I have tried ccache and using precompiled headers, both work well alone but ccache doesn't seem to work together with precompiled headers. The compile times actually increase if they are used togeteher!

I wonder if anyone else have noticed this behavior?



Some more info follows:


This is my timed compile times:

(System: PII-450MHz, 320MB RAM, Mandrake-Linux 10.1, g++ 3.4.1-4mdk, ccache v2.4)

No ccache, no precompiled commonheaders
---------------------------------------
Rebuild all: 4:04
Incremental build (changes in two files): 1:47

only ccache
-----------
Rebuild all (clean cache): 4:21
Incremental build (changes in two files): 0:44
Rebuild all (no changes): 0:30
Incremental build (changes in two files): 0:28

only precompiled commonheaders
------------------------------
Rebuild all: 2:37, 1:36, 1:50, 1:36
Incremental build (changes in two files): 0:10, 0:10

ccache (empty cache) + precompiled commonheaders
------------------------------------------------
Rebuild all: 6:24, 5:30, 7:08, 7:34 (!?)
Incremental build (changes in two files): 0:44, 0:45
Rebuild all (no changes): 9:06, 5:28
Incremental build (changes in two files): 0:45, 0:44






It seems like ccache can't handle this situation because this is what I get if I run ccache -s after a compile with precompiled headers:

-----
cache directory /home/xxx/.ccache
cache hit 0
cache miss 0
called for link 4
preprocessor error 32
unsupported compiler option 2
files in cache 0
cache size 0 Kbytes
max cache size 976.6 Mbytes
-----





My "commonheader.h" file


#ifndef COMMONHEADERS_H
#define COMMONHEADERS_H

//#include "commonheaders.h"
//------------------------


// This headerfile includes all common include files that
// are needed for the project and doesn't change often.

// The idea is to speed up compile times using precompiled headers. See
// http://www.bcbdev.com/articles/pch.htm

// You have to tell the qmake project file that this file should be
// precompiled, otherwise it will actually seem to be slower:
//
// CONFIG += precompile_header
// PRECOMPILED_HEADER += commonheaders.h

using namespace std;

/* Add C includes here */

#if defined __cplusplus
/* Add C++ includes here */

// QT Classes
#include <qapplication.h>
#include <qstring.h>
#include <qsettings.h>
#include <qtable.h>
#include <qfiledialog.h>
#include <qstringlist.h>
#include <qwidget.h>
#include <qprocess.h>
#include <qtextstream.h>
#include <qmessagebox.h>

// Standard c++ classes
#include <iostream>
#include <map>
#include <fstream>
#include <sstream>
#include <utility>

// Project classes
#include "constants.h"
#include "profiletableitem.h"

#endif

#endif
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware 10.2 & 2.4.31 headers SlackwareInAZ Slackware 2 09-17-2005 10:26 AM
Japanese canna won't work : Warning: &#12363;&#12394;&#28450;&#23383;&#22793;&am OrganicOrange84 Debian 3 06-30-2005 03:28 PM
QT Libraries & Headers inescapeableus Linux - Software 9 05-03-2005 02:14 AM
precompiled kernels & modules linuxhippy Slackware 5 03-14-2005 08:46 PM
Autoresponders & CGI Forms & E-mail Headers Big Brad Linux - Newbie 0 05-25-2004 07:45 AM


All times are GMT -5. The time now is 04:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration