[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Header file inclusion speed again
From: |
Markus Hitter |
Subject: |
Header file inclusion speed again |
Date: |
Sat, 4 Jan 2003 14:12:28 +0100 |
Hi all again,
last time I tried to measure the speed increase of precompiled headers,
the result was: Either it's on and fast or, it's off and slow. No
difference how much and which style headers are included.
As you perhaps remember, in most of the files, I set headers up like:
#ifdef HAS_PRECOMPILED_HEADERS
#import <Foundation/Foundation.h>
#else
#import <Foundation/NSObject.h>
...
@class NSDictionary;
...
#endif
#import <EOControl/EOWhatever.h>
...
The day after, I dicovered that one of my config header always included
the full <Foundation/Foundation.h>, independant of wether I set
HAS_PRECOMPILED_HEADERS to on or to off.
Today, I removed this fault and got new measurements (for a now bigger
set of sources). This time I'm quite sure I did it right as I had to
fix some missing header inclusions. Here are the timings:
HAS_PRECOMPILED_HEADERS undefined: 2 Minutes, 15 Seconds
HAS_PRECOMPILED_HEADERS defined: 2 Minutes, 7 Seconds
HAS_PRECOMPILED_HEADERS undefined, gcc with -no-cpp-precomp(*): 7
Minutes, 24 Seconds
HAS_PRECOMPILED_HEADERS defined, gcc with -no-cpp-precomp: 10 Minutes,
0 Seconds
HAS_PRECOMPILED_HEADERS undefined, early umbrella header inclusion: 2
Minutes, 8 Seconds
HAS_PRECOMPILED_HEADERS defined, early umbrella header inclusion: 2
Minutes, 8 Seconds
HAS_PRECOMPILED_HEADERS undefined, early umbrella header inclusion, gcc
with -no-cpp-precomp: 9 Minutes, 58 Seconds
hmm ...
So, here's my interpretation of the results:
- using umbrella headers doesn't give as much speed increase as one
might think. At least, with Apple's set of Foundation headers. Perhaps
they include the umbrella header in the single-class header files.
- Using a well defined set of single headers inclusions gives a
significant speed increase without a precompiler but a marginal speed
drop with precompilation enabled. Thats an argument against the
umbrella header inclusion in single-class header files.
- Any complex mechanism for differing wether a precompiled header is to
be used is obsolete. Simply include the umbrella header in a common,
early included file (config.h or similar).
Have fun,
Markus
* This flag switches the precompiler off which is enabled by default.
- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Header file inclusion speed again,
Markus Hitter <=