Skip to content

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

Dmitry Kazakov requested to merge kazakov/precompiled-headers into master

Basically, the usage of precompiled headers makes compilation 35% lower (1.6x speedup). Krita compilation on 4+4 core CPU without unittests drops from 28:49 to 18:49.

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