Skip to content

Conversation

ulmus-scott
Copy link
Contributor

This improves compiler analysis since the entire class definition
is in one compilation unit and decreases compile and link times
due to fewer object files being linked together. In addition,
for CMake this greatly speeds up incremental compilation since
this avoids the use of mocs_compilation.cpp where every moc_*.cpp
file was included.

I first had to fix header guards and hide the troublesome X11 headers. This includes #1151 since that moved some of the X11 including headers.

With ccache, this was 1-2% faster. With ccache cleared, qmake was about 10% faster.

Checklist

ulmus-scott and others added 16 commits August 16, 2025 19:03
which the CMake build does and the check for vaCreateSurfaces()
effectively already did.
<va/va_glx.h> also includes X11 headers via <GL/glx.h>.
so they can be disabled separately.  Gentoo removed the GLX
backend for libva to simplify packaging.

<GL/glx.h> is included by <va/va_glx.h>, so it doesn't need
to be checked separately.
Add an additional message_XXX function for printing a path [in brackets].
and move MythNVControl into mythnvcontrol.cpp,
hiding the X11 includes from the header file.
and make LOG message selection easier to read.
X11 defines many annoying global declarations, typedefs, and macros.

Unfortunately, the Display typedef cannot be forward declared
in mythxdisplay.h.  `using Window = unsigned long` would work,
however.
This improves compiler analysis since the entire class definition
is in one compilation unit and decreases compile and link times
due to fewer object files being linked together.  In addition,
for CMake this greatly speeds up incremental compilation since
this avoids the use of mocs_compilation.cpp where every moc_*.cpp
file was included.

Build times with a cleared ccache (no LTO):
                Build   Test    Build plugins
qmake (before): 219.458 39.463  22.682
qmake (after) : 202.001 37.023  17.981
CMake (before): 246.225 24.18   n/a
CMake (after) : 241.419 24.122  n/a

Build times after git clean -xdf (filled ccache) (no LTO):
                Build   Test    Build plugins
qmake (before): 21.777  27.249  1.334
qmake (after) : 21.411  26.920  1.248
CMake (before): 54.205  24.08   n/a
CMake (after) : 53.860  24.148  n/a

A full rebuild with qmake is about 10% faster.
A full rebuild with CMake is about 2% faster.

After git clean -xdf, this is about 1-2% faster.

libmythprotoserver/socketrequesthandler.h is header only,
so mythsocketmanager.cpp is as good a place as any since
it already uses SocketRequestHandler.

mythfrontend/settingshelper.h and most of the files in
mythfrontend/servicecontracts/ and mythbackend/servicesv2/
are header only, so there is no good place to include each
moc_*.cpp file.  A few files in mythcommflag,
mythtv-setup/expertsettingseditor.h,
libmythbase/mythsystemprivate.h, libmythtv/channelscan/paneatsc.h,
and libmythtv/channelscan/panedvbutilsimport.h are also header only.

I used the script from
https://raymii.org/s/blog/Qt_add_moc_includes_to_speed_up_compilation.html
and manually touched it up.  The script does not account
for Q_OBJECT in a .cpp file.

Some further discussion of this, with some other scripts linked, is here:
https://planet.kde.org/friedrich-kossebau-2023-06-28-include-also-moc-files-of-headers/
Only the backend recording extender test uses SQLite if available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants