From f13aeaf2f1e43032454bc53d2832f01e114a9817 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Sun, 17 Aug 2025 00:57:06 +0300 Subject: [PATCH] libutil-tests: Improve compile times with PCH (Before) **** Time summary: Compilation (30 times): Parsing (frontend): 98.2 s Codegen & opts (backend): 27.7 s (After) **** Time summary: Compilation (31 times): Parsing (frontend): 34.9 s Codegen & opts (backend): 28.1 s --- src/libutil-tests/meson.build | 1 + src/libutil-tests/pch/precompiled-headers.hh | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 src/libutil-tests/pch/precompiled-headers.hh diff --git a/src/libutil-tests/meson.build b/src/libutil-tests/meson.build index e4a060d3e..6f04b46fd 100644 --- a/src/libutil-tests/meson.build +++ b/src/libutil-tests/meson.build @@ -89,6 +89,7 @@ this_exe = executable( link_args : linker_export_flags + [ '-lrapidcheck' ], # get main from gtest install : true, + cpp_pch : do_pch ? [ 'pch/precompiled-headers.hh' ] : [], ) test( diff --git a/src/libutil-tests/pch/precompiled-headers.hh b/src/libutil-tests/pch/precompiled-headers.hh new file mode 100644 index 000000000..0a078fcc4 --- /dev/null +++ b/src/libutil-tests/pch/precompiled-headers.hh @@ -0,0 +1,5 @@ +#include "nix/util/util.hh" + +#include +#include +#include