Skip to content

WIP: Implement precompiled headers to optimize building Krita (by 35%)

Compilation time measured with unittests disabled:

with PCH (7aa76def) w/o PCH (81a31796)
AMD Ryzen 7 2700X (8+8) Windows+Ninja 18:45 min 22:27 min
Intel Core i7 i7-4700MQ (4+4) Linux+Makefiles 19:20 min 28:39 min

Compilation time measured with unittests enabled:

with PCH (089de196) w/o PCH (81a31796)
AMD Ryzen 7 2700X (8+8) Windows+Ninja 22:56 min 27:49 min
Intel Core i7 i7-4700MQ (4+4) Linux+Makefiles 28:40 min 40:50 min

Now a new library can be added in the following three ways:

  1. add_library --- standard way, it doesn't add any precompiled headers, you should add that manually. See example in libs/global/CMakeLists.txt

  2. kis_add_core_library --- add library that depends on kritaglobal (basically, it needs kis_global.h and kis_assert.h)

  3. kis_add_library --- add a library that depends on kritaimage. Compared to "core library" is also needs kis_types.h.

This patch does not implement precompiled headers for unittests. It needs separate work.

Test Plan

Just build branch with your preferred compiler on your preferred OS. It should build fine and it shouldn't cry about "precompiled headers are not supported" in the cmake log.

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Dmitry Kazakov

Merge request reports