mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-10-22 13:31:27 +02:00
pybind11_add_module links pybind11::lto, which adds full -flto to the extension and ignores the target's INTERPROCEDURAL_OPTIMIZATION property. That link ran single-threaded for 19-22 s and was the longest step of the build. LTO cannot reach aare_core (a plain static library) and the hot loops are header templates compiled at -O3 inside the extension anyway. Pass NO_EXTRAS so the standard CMake property decides (off by default), and re-add the extras pybind11 would have applied: pybind11_strip for optimized builds and pybind11::windows_extras (/bigobj, /MP) on MSVC. set_property(TARGET _aare PROPERTY INTERPROCEDURAL_OPTIMIZATION ON) or -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON brings LTO back as ThinLTO. Measured on a clean Release build with tests: 42 s -> 28 s, extension link 19 s -> 0.1 s, exports identical, all tests pass. The stripped binary grows from 4.7 MB to 5.6 MB. Pedestal, eta and the aare_core code paths (fits, calibration, decoding) run at the same speed; the ClusterFinder micro-benchmark is consistently 1-2 % slower without LTO.