Running: gcc version 4.2.1 (Apple Inc. build 5664)
I created an apple XCode project with a default precompiled header. It appears to be very slow, and a trivial main file with a main function no includes no code takes 6 seconds to compile, which is after I upgraded to a new SSD drive. I am on a laptop, but I have reservations that upgrading to a workstation would alleviate my problem. If I turn off the precompiled header then the main file compiles in under a second. It appears that using a precompiled header puts a penalty across all files. This delay is makes me want to avoid compiling and experimenting with code which is not good. Here is what I am including in my precompiled header:
#pragma once #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <fstream> #include <functional> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <valarray> #include <vector> #include <boost/smart_ptr/scoped_ptr.hpp> #include <boost/smart_ptr/scoped_array.hpp> #include <boost/smart_ptr/shared_ptr.hpp> #include <boost/smart_ptr/shared_array.hpp> #include <boost/smart_ptr/make_shared.hpp> #include <boost/smart_ptr/weak_ptr.hpp> #include <boost/smart_ptr/intrusive_ptr.hpp> #include <boost/regex.hpp> #include <boost/thread.hpp> #include <boost/bind/bind.hpp> #include <boost/bind/apply.hpp> #include <boost/bind/protect.hpp> #include <boost/bind/make_adaptable.hpp> #include <boost/asio.hpp> //#include <boost/asio/ssl.hpp> #include <boost/property_tree/ptree.hpp> #include <boost/random.hpp> #include <boost/lexical_cast.hpp> #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/local_time/local_time.hpp> #include <boost/date_time/time_zone_base.hpp> #include <boost/circular_buffer.hpp> #include <boost/accumulators/accumulators.hpp> #include <boost/accumulators/statistics.hpp> I have not included spirit, which really makes the compile time go up.
includes from multiple sources. This is not the case for you, so I'd imagine your compile time with using precompiled headers would be similar to without. That is, you wouldn't realize much of a gain by using precompiled headers. You really should limit your includes to what you need on a source-file-specific basis.