On 2017.05.15 at 12:11 +0200, Matthias Kretz wrote: > Hi, > > I'm looking for help on improving the compile times of my unit tests. Compile > times of >60s per TU is making my life hard. > Alternatively, if you can tell me there's nothing I can do, then I can accept > my fate and stop worrying about compile time optimizations. > > Picking one example from my ~500 unit test TUs: > You can see the source at https://github.com/VcDevel/Vc/blob/ > c807aa0c841950e50ec7d370c9c22d6038c7e068/tests/loadstore.cpp > > Note that TEST_TYPES (line 109) produces 91 instantiations of the > `load_store<VU>` function template from an outer product of two type lists. > (I'd actually like to make the type list larger by a factor of 13, but that > just blows the compiler up.) > > Attached is the output of -ftime-report. I must say I was surprised to see > "phase opt and generate" with 62.5s and 95% of the total time, as well as 84% > of the memory usage. Though, OTOH, the resulting binary is 4.4MiB large with > about 3/4 of it being the .text section. > > If you have any ideas what I could do (other than "test less"), I'd like to > try it. Enabling Link Time Optimization may help: -flto=<some number, e.g. the number of cores you have> -- Markus