diff options
author | Jade Lovelace <lix@jade.fyi> | 2024-05-30 13:44:01 -0700 |
---|---|---|
committer | jade <lix@jade.fyi> | 2024-05-30 21:54:21 +0000 |
commit | 0f99ed43f15aba7805ebe6d757a2d98418596205 (patch) | |
tree | f90b6b293ffc4036a24ec530566bbb0d383eeb50 /src | |
parent | e6e5cacabeab0959d092aaf4957932a0b6f4b78e (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/libcmd/meson.build | 1 | ||||
-rw-r--r-- | src/libexpr/meson.build | 1 | ||||
-rw-r--r-- | src/libfetchers/meson.build | 1 | ||||
-rw-r--r-- | src/libmain/meson.build | 1 | ||||
-rw-r--r-- | src/libstore/meson.build | 1 | ||||
-rw-r--r-- | src/libutil/meson.build | 1 | ||||
-rw-r--r-- | src/nix/meson.build | 1 | ||||
-rw-r--r-- | src/pch/precompiled-headers.hh | 60 |
8 files changed, 67 insertions, 0 deletions
diff --git a/src/libcmd/meson.build b/src/libcmd/meson.build index 4da1b496b..4dc0714c8 100644 --- a/src/libcmd/meson.build +++ b/src/libcmd/meson.build @@ -54,6 +54,7 @@ libcmd = library( nlohmann_json, lix_doc ], + cpp_pch : ['../pch/precompiled-headers.hh'], install : true, # FIXME(Qyriad): is this right? install_rpath : libdir, diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index fda6fde2c..9a18c7ab3 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -145,6 +145,7 @@ libexpr = library( include_directories : [ '../libmain', ], + cpp_pch : ['../pch/precompiled-headers.hh'], install : true, # FIXME(Qyriad): is this right? install_rpath : libdir, diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build index dbb85b84c..365bcd4a7 100644 --- a/src/libfetchers/meson.build +++ b/src/libfetchers/meson.build @@ -30,6 +30,7 @@ libfetchers = library( liblixutil, nlohmann_json, ], + cpp_pch : ['../pch/precompiled-headers.hh'], install : true, # FIXME(Qyriad): is this right? install_rpath : libdir, diff --git a/src/libmain/meson.build b/src/libmain/meson.build index b17247a9d..075aa83b2 100644 --- a/src/libmain/meson.build +++ b/src/libmain/meson.build @@ -20,6 +20,7 @@ libmain = library( liblixutil, liblixstore, ], + cpp_pch : ['../pch/precompiled-headers.hh'], install : true, # FIXME(Qyriad): is this right? install_rpath : libdir, diff --git a/src/libstore/meson.build b/src/libstore/meson.build index f776e9621..65ecacc20 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -220,6 +220,7 @@ libstore = library( nlohmann_json, ], cpp_args : cpp_args, + cpp_pch : ['../pch/precompiled-headers.hh'], install : true, # FIXME(Qyriad): is this right? install_rpath : libdir, diff --git a/src/libutil/meson.build b/src/libutil/meson.build index 96450fbe2..cfdd0e52c 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -129,6 +129,7 @@ libutil = library( openssl, nlohmann_json, ], + cpp_pch : ['../pch/precompiled-headers.hh'], implicit_include_directories : true, install : true, ) diff --git a/src/nix/meson.build b/src/nix/meson.build index e41399b5d..45303641f 100644 --- a/src/nix/meson.build +++ b/src/nix/meson.build @@ -89,6 +89,7 @@ nix = executable( boehm, nlohmann_json, ], + cpp_pch : ['../pch/precompiled-headers.hh'], install : true, # FIXME(Qyriad): is this right? install_rpath : libdir, diff --git a/src/pch/precompiled-headers.hh b/src/pch/precompiled-headers.hh new file mode 100644 index 000000000..f52f1cab8 --- /dev/null +++ b/src/pch/precompiled-headers.hh @@ -0,0 +1,60 @@ +#include <algorithm> +#include <array> +#include <atomic> +#include <cassert> +#include <cctype> +#include <chrono> +#include <climits> +#include <cmath> +#include <condition_variable> +#include <cstddef> +#include <cstdint> +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <exception> +#include <functional> +#include <future> +#include <iostream> +#include <limits> +#include <list> +#include <locale> +#include <map> +#include <memory> +#include <mutex> +#include <numeric> +#include <optional> +#include <queue> +#include <random> +#include <regex> +#include <set> +#include <sstream> +#include <stack> +#include <stdexcept> +#include <string> +#include <thread> +#include <unordered_map> +#include <unordered_set> +#include <vector> + +#include <boost/format.hpp> + +#include <dirent.h> +#include <errno.h> +#include <fcntl.h> +#include <grp.h> +#include <netdb.h> +#include <pwd.h> +#include <signal.h> +#include <sys/resource.h> +#include <sys/select.h> +#include <sys/socket.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/utsname.h> +#include <sys/wait.h> +#include <termios.h> +#include <unistd.h> + +#include <nlohmann/json.hpp> |