From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: meson: Add support for building with precompiled headers
Date: Fri, 07 Oct 2022 00:23:17 +0000
Message-ID: <E1ogb93-001ESp-14@gemulon.postgresql.org> (raw)
meson: Add support for building with precompiled headers
This substantially speeds up building for windows, due to the vast amount of
headers included via windows.h. A cross build from linux targetting mingw goes
from
994.11user 136.43system 0:31.58elapsed 3579%CPU
to
422.41user 89.05system 0:14.35elapsed 3562%CPU
The wins on windows are similar-ish (but I don't have a system at hand just
now for actual numbers). Targetting other operating systems the wins are far
smaller (tested linux, macOS, FreeBSD).
For now precompiled headers are disabled by default, it's not clear how well
they work on all platforms. E.g. on FreeBSD gcc doesn't seem to have working
support, but clang does.
When doing a full build precompiled headers are only beneficial for targets
with multiple .c files, as meson builds a separate precompiled header for each
target (so that different compilation options take effect). This commit
therefore only changes target with at least two .c files to use precompiled
headers.
Because this commit adds b_pch=false to the default_options new build
directories will have precompiled headers disabled by default, however
existing build directories will continue use the default value of b_pch, which
is true.
Note that using precompiled headers with ccache requires setting
CCACHE_SLOPPINESS=pch_defines,time_macros to get hits.
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>
Discussion: https://postgr.es/m/CA+hUKG+50eOUbN++ocDc0Qnp9Pvmou23DSXu=ZA6fepOcftKqA@mail.gmail.com
Discussion: https://postgr.es/m/c5736f70-bb6d-8d25-e35c-e3d886e4e905@enterprisedb.com
Discussion: https://postgr.es/m/20190826054000.GE7005%40paquier.xyz
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/e5555657ba860f2ac25fb7ef9c921a32c6e70c75
Modified Files
--------------
.cirrus.yml | 2 +-
contrib/bloom/meson.build | 1 +
contrib/btree_gist/meson.build | 1 +
contrib/hstore/meson.build | 1 +
contrib/pg_trgm/meson.build | 1 +
contrib/pgcrypto/meson.build | 1 +
contrib/pgstattuple/meson.build | 1 +
contrib/sepgsql/meson.build | 1 +
contrib/xml2/meson.build | 1 +
meson.build | 1 +
src/backend/meson.build | 5 +++++
src/backend/snowball/meson.build | 1 +
src/bin/pg_dump/meson.build | 1 +
src/bin/pg_upgrade/meson.build | 1 +
src/bin/pgbench/meson.build | 1 +
src/bin/psql/meson.build | 1 +
src/common/meson.build | 2 ++
src/fe_utils/meson.build | 1 +
src/include/meson.build | 1 +
src/include/pch/c_pch.h | 1 +
src/include/pch/meson.build | 4 ++++
src/include/pch/postgres_fe_pch.h | 1 +
src/include/pch/postgres_pch.h | 1 +
src/interfaces/ecpg/ecpglib/meson.build | 2 ++
src/interfaces/ecpg/pgtypeslib/meson.build | 2 ++
src/interfaces/ecpg/preproc/meson.build | 1 +
src/interfaces/libpq/meson.build | 2 ++
src/pl/plperl/meson.build | 1 +
src/pl/plpgsql/src/meson.build | 1 +
src/pl/plpython/meson.build | 1 +
src/pl/tcl/meson.build | 1 +
src/port/meson.build | 2 ++
32 files changed, 44 insertions(+), 1 deletion(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de
Subject: Re: pgsql: meson: Add support for building with precompiled headers
In-Reply-To: <E1ogb93-001ESp-14@gemulon.postgresql.org>
References: <E1ogb93-001ESp-14@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox