From d6973e105cdd5a39150c9d95d851e2d3b9db67c4 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Sun, 17 Aug 2025 00:56:54 +0300 Subject: [PATCH] libexpr-tests: Improve compile times with PCH (Before) **** Time summary: Compilation (14 times): Parsing (frontend): 60.1 s Codegen & opts (backend): 18.0 s (After) **** Time summary: Compilation (15 times): Parsing (frontend): 16.6 s Codegen & opts (backend): 17.4 s --- src/libexpr-tests/meson.build | 1 + src/libexpr-tests/pch/precompiled-headers.hh | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 src/libexpr-tests/pch/precompiled-headers.hh diff --git a/src/libexpr-tests/meson.build b/src/libexpr-tests/meson.build index 1f3973681..cc203d60e 100644 --- a/src/libexpr-tests/meson.build +++ b/src/libexpr-tests/meson.build @@ -75,6 +75,7 @@ this_exe = executable( # TODO: -lrapidcheck, see ../libutil-support/build.meson link_args : linker_export_flags + [ '-lrapidcheck' ], install : true, + cpp_pch : do_pch ? [ 'pch/precompiled-headers.hh' ] : [], ) test( diff --git a/src/libexpr-tests/pch/precompiled-headers.hh b/src/libexpr-tests/pch/precompiled-headers.hh new file mode 100644 index 000000000..63bf023a2 --- /dev/null +++ b/src/libexpr-tests/pch/precompiled-headers.hh @@ -0,0 +1,4 @@ +#include "nix/expr/tests/libexpr.hh" + +#include +#include