Skip to content

Commit 5976a2e

Browse files
committed
Documented PCH support
Added PCH support to benchmark
1 parent af37ead commit 5976a2e

File tree

3 files changed

+86
-9
lines changed

3 files changed

+86
-9
lines changed

README.md

+17-9
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ There are two optimization levels for moc objects :
2020
- group every QObject classes (headers) into a single header, then call moc on this file. (`MOC_LVL_2`, even faster)
2121

2222
QMake-unity provides good integration with Qt 5 tooling system (qmake, moc, qt-creator) and with MSBuild.
23+
It is compatible with precompiled headers (PCH).
2324

2425
Here are general articles if you want to understand how it works :
2526
- [Jumbo, A unity build system for Chromium](https://bit.ly/jumbo-blinkon9)
@@ -222,14 +223,21 @@ It has been run on a Windows 10 laptop powered by an i5 8250u.
222223

223224
### [QupZilla](https://github.com/QupZilla/qupzilla) built with `MSVC`
224225

225-
| Project part | QMake-unity | Time |
226-
| ------------ | ------------ | ---------------- |
227-
| lib | not enabled | 3m14 |
228-
| lib | MOC_LVL_1 | 52s (73% faster) |
229-
| lib | MOC_LVL_2 | 26s (87% faster) |
230-
| plugins | not enabled | 1m15 |
231-
| plugins | MOC_LVL_1 | 27s (64% faster) |
232-
| plugins | MOC_LVL_2 | 22s (71% faster) |
226+
PCH raw = 59s
227+
PCH + MOC_LVL_1 = 35s
228+
PCH + MOC_LVL_2 = 19s
229+
230+
| Project part | QMake-unity | PreCompiledHeader (PCH) | Time |
231+
| ------------ | ------------ | ----------------------- | ---------------- |
232+
| lib | not enabled | not enabled | 3m14 |
233+
| lib | MOC_LVL_1 | not enabled | 52s (73% faster) |
234+
| lib | MOC_LVL_2 | not enabled | 26s (87% faster) |
235+
| lib | not enabled | enabled | 59s (70% faster) |
236+
| lib | MOC_LVL_1 | enabled | 35s (82% faster) |
237+
| lib | MOC_LVL_2 | enabled | 15s (92% faster) |
238+
| plugins | not enabled | not enabled | 1m15 |
239+
| plugins | MOC_LVL_1 | not enabled | 27s (64% faster) |
240+
| plugins | MOC_LVL_2 | not enabled | 22s (71% faster) |
233241

234242
### [QtXlsxWriter](https://github.com/dbzhang800/QtXlsxWriter) built with `MinGW`
235243
| QMake-unity | Time |
@@ -252,9 +260,9 @@ It has been run on a Windows 10 laptop powered by an i5 8250u.
252260
## What else can I do to speedup my build
253261

254262
**Pure C++ techniques :**
263+
- Use precompiled headers (PCH) : useful for big executables/libraries
255264
- Forward declare headers (incremental build)
256265
- Write less templates
257-
- Use precompiled headers (PCH)
258266

259267
**Qt :**
260268
- If you build in VisualStudio, install Qt Visual Studio Tools <= 2.2; which now supports parallel calls of moc.

test/qupzilla-master/src/lib/lib.pro

+3
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@ message(===========================================)
502502
message( Using following defines:)
503503
message( $$DEFINES)
504504

505+
PRECOMPILED_HEADER = pch.h
506+
CONFIG += precompile_header
507+
505508
UNITY_BUILD = 1
506509
UNITY_MOC_MODE = MOC_LVL_2
507510
include(../../../../qmakeUnity/qmake_unity.pri)

test/qupzilla-master/src/lib/pch.h

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#include <QAction>
2+
#include <QApplication>
3+
#include <QBuffer>
4+
#include <QByteArray>
5+
#include <QCheckBox>
6+
#include <QClipboard>
7+
#include <QColor>
8+
#include <QComboBox>
9+
#include <QDateTime>
10+
#include <QDebug>
11+
#include <QDialog>
12+
#include <QDir>
13+
#include <QDrag>
14+
#include <QFile>
15+
#include <QFlags>
16+
#include <QFrame>
17+
#include <QHBoxLayout>
18+
#include <QHash>
19+
#include <QHeaderView>
20+
#include <QIcon>
21+
#include <QJsonArray>
22+
#include <QJsonDocument>
23+
#include <QJsonObject>
24+
#include <QJsonValue>
25+
#include <QLabel>
26+
#include <QLineEdit>
27+
#include <QList>
28+
#include <QMap>
29+
#include <QMenu>
30+
#include <QMessageBox>
31+
#include <QMetatype>
32+
#include <QMimeData>
33+
#include <QMouseEvent>
34+
#include <QPainter>
35+
#include <QPalette>
36+
#include <QPixmap>
37+
#include <QPointer>
38+
#include <QProcess>
39+
#include <QPushButton>
40+
#include <QRadioButton>
41+
#include <QScrollBar>
42+
#include <QSpacerItem>
43+
#include <QSslCertificate>
44+
#include <QStackedLayout>
45+
#include <QStackedWidget>
46+
#include <QStringList>
47+
#include <QStyle>
48+
#include <QSysInfo>
49+
#include <QTabWidget>
50+
#include <QTemporaryFile>
51+
#include <QTextDocument>
52+
#include <QTimer>
53+
#include <QToolButton>
54+
#include <QToolTip>
55+
#include <QUrl>
56+
#include <QUrlQuery>
57+
#include <QVBoxLayout>
58+
#include <QVariant>
59+
#include <QVector>
60+
#include <QWebEngineContextMenuData>
61+
#include <QWebEngineHistory>
62+
#include <QWebEnginePage>
63+
#include <QWidget>
64+
//#include <QPrintDialog>
65+
//#include <QPrinter>
66+
//#include <QQuickWidget> pb avec macro "interface"

0 commit comments

Comments
 (0)