aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-08-22 20:36:35 -0700
committerJade Lovelace <lix@jade.fyi>2024-08-23 13:23:33 -0700
commitaf546be20560c5e192b8cf8df5d28c94ea7a9832 (patch)
tree2d6a72a5f19f6ae92a9b59d94eb8ce115c0157af /meson.build
parent9aacf425dc2ec6e3284ffb1fce27ce55786627a2 (diff)
build: remove approximately 400 seconds of CPU time (30%)
This took parsing time from 1421s or so to 1060s or so. The reason is entirely nlohmann. All of the stuff below is just Obliterated because it's built in the PCH instead: **** Templates that took longest to instantiate: 219051 ms: nlohmann::basic_json<>::parse<const char *> (276 times, avg 793 ms) 169675 ms: nlohmann::basic_json<>::basic_json (1127 times, avg 150 ms) 129416 ms: nlohmann::detail::parser<nlohmann::basic_json<>, nlohmann::detail::i... (276 times, avg 468 ms) 98155 ms: nlohmann::detail::parser<nlohmann::basic_json<>, nlohmann::detail::i... (276 times, avg 355 ms) 81322 ms: nlohmann::basic_json<>::json_value::json_value (1405 times, avg 57 ms) 53531 ms: nlohmann::detail::json_sax_dom_callback_parser<nlohmann::basic_json<... (276 times, avg 193 ms) clang-only. This brings the clang build time to not far from *half* of the gcc build time. Also, clang does not enjoy so much to miscompile coroutines. Maybe we should just be clang-only. Change-Id: Id3135db0094e4560830674090e32e6da2c22fcc6
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build11
1 files changed, 11 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index ea713acf0..3a772ac08 100644
--- a/meson.build
+++ b/meson.build
@@ -147,6 +147,17 @@ if should_pch
# Unlike basically everything else that takes a file, Meson requires the arguments to
# cpp_pch : to be strings and doesn't accept files(). So absolute path it is.
cpp_pch = [meson.project_source_root() / 'src/pch/precompiled-headers.hh']
+
+ # Saves about 400s (30% at time of writing) from compile time on-cpu, mostly
+ # by removing instantiations of nlohmann from every single damned compilation
+ # unit.
+ # There is no equivalent in gcc.
+ if cxx.get_id() == 'clang'
+ add_project_arguments(
+ '-fpch-instantiate-templates',
+ language : 'cpp',
+ )
+ endif
else
cpp_pch = []
endif