i dont know about this yet here is something from gtkmm july 2004
- From: "Cristian Adam"
- To: gtkmm-list gnome org
- Subject: [gtkmm] precompiled headers [revisited]
- Date: Wed, 21 Jul 2004 21:47:36 +0200 (MEST)
Take this small gtkmm application:
hello.cpp:
//--------------------------------------------------------
#ifdef USE_PCH
#include "precompiled.h"
#else
#include
#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
#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.
- From: Christer Palm
- To: Cristian Adam
- Cc: gtkmm-list gnome org
- Subject: Re: [gtkmm] precompiled headers [revisited]
- Date: Thu, 22 Jul 2004 01:49:39 +0200
Cristian Adam wrote:
The compilation was ~6 (six) times faster with precompiled headers!!!
Precompiled headers rulle!!!
OK - I'm seeing similar results now (even with more complex examples - about 4 times faster). I guess my problem was that the precompiled header should be named gtkmm.h.gch and not gtkmm.gch. However, I quickly stumbled across GCC bug 13675 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13675), which was rather easily worked around by using 2 include files like: A.h:
#ifndef A_INCLUDED
#define A_INCLUDED
#include "B.h"
#endif
B.h:
#include
and then precompiling B.h, while including A.h in my source files. So it seems that it's not quite ready for prime time yet, but I still think it'd be rather interesting to have a build target for gtkmm.h.pch in the standard gtkmm makefile. --
Christer Palm
and from
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/sec-visual-studio-new-project.html
The next thing to alter is the stdafx.h
precompiled
header file. At the time of this writing, many Windows programmers are
familiar with the concept of precompiled headers. However, many Unix
programmers are not, as precompiled header support was only recently added
to GCC (in version 3.4) and is still not used in most open source projects.
Unix programmers may be tempted to just disable precompiled headers
altogether, but think carefully before doing this. Proper use of precompiled
headers provides a much improved compile time when using gtkmm, and will
save you many hours over the course of a project.
1 comment:
彌月禮盒團購美食 印刷 彩色印刷 包裝 設計pe膜 冬令營 food processing equipment frying machine Telecom PCB 泡菜 團購美食油飯麻糬
創業加盟 水餃 壯陽食品 早洩漆彈情趣用品 湯包 搬家公司 會場設計紙盒訂裝 展覽設計展場設計 展覽設計 消防設備 消防設備 機電 崴立機電 牙齒美白 植牙
Post a Comment