[gtkmm] precompiled headers [revisited]



Take this small gtkmm application:

hello.cpp:
//--------------------------------------------------------
#ifdef USE_PCH
    #include "precompiled.h"
#else
    #include <gtkmm.h>
#endif

int main(int argc, char* argv[])
{
    Gtk::Main kit(argc, argv);

    Gtk::Window window;

    Gtk::Main::run(window);

    return 0;
}

precompiled.h
//--------------------------------------------------------
#ifndef PRECOMPILED_H
#define PRECOMPILED_H

#include <gtkmm.h>

#endif


The command to create the precompiled header was:
g++ -o precompiled.h.gch precompiled.h `pkg-config --cflags gtkmm-2.4`

The command to compile hello was:
time g++ -o hello hello.cpp `pkg-config --cflags --libs gtkmm-2.4` -DUSE_PCH

The results are below:

With PCH    Normal
--------------------
0m1.172s    0m6.955s 
0m1.168s    0m6.930s 
0m1.173s    0m7.154s 
--------    -------- 
0m1.171s    0m7.013s 

The compilation was ~6 (six) times faster with precompiled headers!!!

Precompiled headers rulle!!!

Cheers,
Cristi.

-- 
+++ GMX DSL-Tarife 3 Monate gratis* +++ Nur bis 25.7.2004 +++
Bis 24.000 MB oder 300 Freistunden inkl. http://www.gmx.net/de/go/dsl




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]