# Precompiled headers (PCH) in ITK

**URL:** https://discourse.itk.org/t/precompiled-headers-pch-in-itk/2318
**Category:** Engineering
**Tags:** optimization, cmake
**Created:** [October 11, 2019, 1:06pm UTC](https://discourse.itk.org/t/precompiled-headers-pch-in-itk/2318 "2019-10-11T13:06:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![phcerdan](https://discourse.itk.org/user_avatar/discourse.itk.org/phcerdan/32/286_2.png) [@phcerdan](https://discourse.itk.org/u/phcerdan)
#### Post date: [October 11, 2019, 1:06pm UTC](https://discourse.itk.org/t/precompiled-headers-pch-in-itk/2318/1 "2019-10-11T13:06:06Z")

</div>

[CMake 3.16.0](https://blog.kitware.com/cmake-3-16-0-rc1-is-ready-for-testing/) adds support for creating targets with precompiled headers.  
I wasn’t familiar with this term, but we have had discussions about instantiating templates to reduce the compile time of the library.

It seems promising and appealing for development, however there is a trade-off, compile time is reduced, but build directory size is increased (because every target will get its own precompiled header).  
See [this nice blog post, by the Qt team, explaining it](https://www.qt.io/blog/2019/08/01/precompiled-headers-and-unity-jumbo-builds-in-upcoming-cmake) and contributed to CMake by [Daniel Pfeifer](https://www.youtube.com/watch?v=bsXLMQ6WgIk&feature=youtu.be&t=4758)

It would nice to explore it for ITK, I am just starting to read about it, please chime in if you have experience with precompiled headers 🙂

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [October 16, 2019, 9:07pm UTC](https://discourse.itk.org/t/precompiled-headers-pch-in-itk/2318/2 "2019-10-16T21:07:43Z")

</div>

I [tested pre-compiled headers with the goal to reduce ITK build times extensively a few years ago](https://itk.org/pipermail/insight-developers/2015-November/024640.html). Sadly, there was no significant reduction in build times :-(.

---

<div class="post-metadata">

### Author: ![phcerdan](https://discourse.itk.org/user_avatar/discourse.itk.org/phcerdan/32/286_2.png) [@phcerdan](https://discourse.itk.org/u/phcerdan)
#### Post date: [October 16, 2019, 9:33pm UTC](https://discourse.itk.org/t/precompiled-headers-pch-in-itk/2318/3 "2019-10-16T21:33:14Z")

</div>

Ups, good to know @matt.mccormick, thanks!
