build-time: remove 20% more by PCH'ing C++ stdlib

It seems like someone implemented precompiled headers a long time ago
and then it never got ported to meson or maybe didn't work at all.

This is, however, blessedly easy to simply implement. I went looking for
`#define` that could affect the result of precompiling the headers, and
as far as I can tell we aren't doing any of that, so this should truly
just be free build time savings.

Previous state:
Compilation (551 times):
  Parsing (frontend):         1302.1 s
  Codegen & opts (backend):    956.3 s

New state:
**** Time summary:
Compilation (567 times):
  Parsing (frontend):         1123.0 s
  Codegen & opts (backend):   1078.1 s

I wonder if the "regression" in codegen time is just doing the PCH
operation a few times, because meson does it per-target.

Change-Id: I664366b8069bab4851308b3a7571bea97ac64022
This commit is contained in:
jade 2024-05-30 13:44:01 -07:00 committed by jade
parent e6e5cacabe
commit 0f99ed43f1
11 changed files with 18 additions and 5 deletions

View file

@ -87,11 +87,12 @@ pre-commit-run {
"file" "file"
"header" "header"
]; ];
excludes = [
''^src/pch/.*$''
# generated files; these will never actually be seen by this # generated files; these will never actually be seen by this
# check, and are left here as documentation # check, and are left here as documentation
excludes = [ ''(parser|lexer)-tab\.hh$''
"(parser|lexer)-tab\\.hh$" ''\.gen\.hh$''
"\\.gen\\.hh$"
]; ];
entry = lib.getExe pkgs.check-headers; entry = lib.getExe pkgs.check-headers;
}; };

View file

@ -169,7 +169,6 @@ stdenv.mkDerivation (finalAttrs: {
./boehmgc-coroutine-sp-fallback.diff ./boehmgc-coroutine-sp-fallback.diff
./doc ./doc
./misc ./misc
./precompiled-headers.h
./src ./src
./COPYING ./COPYING
] ]

View file

@ -54,6 +54,7 @@ libcmd = library(
nlohmann_json, nlohmann_json,
lix_doc lix_doc
], ],
cpp_pch : ['../pch/precompiled-headers.hh'],
install : true, install : true,
# FIXME(Qyriad): is this right? # FIXME(Qyriad): is this right?
install_rpath : libdir, install_rpath : libdir,

View file

@ -145,6 +145,7 @@ libexpr = library(
include_directories : [ include_directories : [
'../libmain', '../libmain',
], ],
cpp_pch : ['../pch/precompiled-headers.hh'],
install : true, install : true,
# FIXME(Qyriad): is this right? # FIXME(Qyriad): is this right?
install_rpath : libdir, install_rpath : libdir,

View file

@ -30,6 +30,7 @@ libfetchers = library(
liblixutil, liblixutil,
nlohmann_json, nlohmann_json,
], ],
cpp_pch : ['../pch/precompiled-headers.hh'],
install : true, install : true,
# FIXME(Qyriad): is this right? # FIXME(Qyriad): is this right?
install_rpath : libdir, install_rpath : libdir,

View file

@ -20,6 +20,7 @@ libmain = library(
liblixutil, liblixutil,
liblixstore, liblixstore,
], ],
cpp_pch : ['../pch/precompiled-headers.hh'],
install : true, install : true,
# FIXME(Qyriad): is this right? # FIXME(Qyriad): is this right?
install_rpath : libdir, install_rpath : libdir,

View file

@ -220,6 +220,7 @@ libstore = library(
nlohmann_json, nlohmann_json,
], ],
cpp_args : cpp_args, cpp_args : cpp_args,
cpp_pch : ['../pch/precompiled-headers.hh'],
install : true, install : true,
# FIXME(Qyriad): is this right? # FIXME(Qyriad): is this right?
install_rpath : libdir, install_rpath : libdir,

View file

@ -129,6 +129,7 @@ libutil = library(
openssl, openssl,
nlohmann_json, nlohmann_json,
], ],
cpp_pch : ['../pch/precompiled-headers.hh'],
implicit_include_directories : true, implicit_include_directories : true,
install : true, install : true,
) )

View file

@ -89,6 +89,7 @@ nix = executable(
boehm, boehm,
nlohmann_json, nlohmann_json,
], ],
cpp_pch : ['../pch/precompiled-headers.hh'],
install : true, install : true,
# FIXME(Qyriad): is this right? # FIXME(Qyriad): is this right?
install_rpath : libdir, install_rpath : libdir,

View file

@ -68,6 +68,7 @@ libutil_tester = executable(
liblixutil_test_support, liblixutil_test_support,
nlohmann_json, nlohmann_json,
], ],
cpp_pch : ['../../src/pch/precompiled-headers.hh'],
) )
test( test(
@ -102,6 +103,7 @@ libstore_test_support = library(
include_directories : include_directories( include_directories : include_directories(
'libstore-support', 'libstore-support',
), ),
cpp_pch : ['../../src/pch/precompiled-headers.hh'],
) )
liblixstore_test_support = declare_dependency( liblixstore_test_support = declare_dependency(
include_directories : include_directories('libstore-support'), include_directories : include_directories('libstore-support'),
@ -135,6 +137,7 @@ libstore_tester = executable(
gtest, gtest,
nlohmann_json, nlohmann_json,
], ],
cpp_pch : ['../../src/pch/precompiled-headers.hh'],
) )
test( test(
@ -166,6 +169,7 @@ libexpr_test_support = library(
include_directories : include_directories( include_directories : include_directories(
'libexpr-support', 'libexpr-support',
), ),
cpp_pch : ['../../src/pch/precompiled-headers.hh'],
) )
liblixexpr_test_support = declare_dependency( liblixexpr_test_support = declare_dependency(
include_directories : include_directories('libexpr-support'), include_directories : include_directories('libexpr-support'),
@ -199,6 +203,7 @@ libexpr_tester = executable(
gtest, gtest,
nlohmann_json, nlohmann_json,
], ],
cpp_pch : ['../../src/pch/precompiled-headers.hh'],
) )
test( test(
@ -225,6 +230,7 @@ libcmd_tester = executable(
gtest, gtest,
boost, boost,
], ],
cpp_pch : ['../../src/pch/precompiled-headers.hh'],
) )
test( test(