aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-04-07 17:19:37 -0700
committerJade Lovelace <lix@jade.fyi>2024-04-08 15:40:12 -0700
commit0d37b99a155a82ea629ffc533c8f33250f6a4dd9 (patch)
tree407b3227b30d8d59333ca790b0456e13d9635d70 /meson.build
parent06f17a5c78c33120afd71a94f907bfdabd5c40aa (diff)
build: enable libstdc++ assertions
Benchmarks say that it does not regress performance by more than 1% (which is where it gets really hard to measure accurately anyhow). Meson appears to be planning to do this for us without asking us in a release we will get in the future, and it seems good enough to ship today: https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions Benchmarks: | Command | Mean [ms] | Min [ms] | Max [ms] | Relative | |:---|---:|---:|---:|---:| | `result-asserts/bin/nix --extra-experimental-features 'nix-command flakes' eval -f ../nixpkgs/pkgs/development/haskell-modules/hackage-packages.nix` | 418.4 ± 25.0 | 396.9 | 451.2 | 1.01 ± 0.08 | | `result/bin/nix --extra-experimental-features 'nix-command flakes' eval -f ../nixpkgs/pkgs/development/haskell-modules/hackage-packages.nix` | 416.1 ± 23.9 | 397.1 | 445.4 | 1.00 | | Command | Mean [s] | Min [s] | Max [s] | Relative | |:---|---:|---:|---:|---:| | `GC_INITIAL_HEAP_SIZE=10g result-asserts/bin/nix eval --extra-experimental-features 'nix-command flakes' --raw --impure --expr 'with import <nixpkgs/nixos> {}; system'` | 4.147 ± 0.021 | 4.123 | 4.195 | 1.00 | | `GC_INITIAL_HEAP_SIZE=10g result/bin/nix eval --extra-experimental-features 'nix-command flakes' --raw --impure --expr 'with import <nixpkgs/nixos> {}; system'` | 4.149 ± 0.027 | 4.126 | 4.215 | 1.00 ± 0.01 | | Command | Mean [s] | Min [s] | Max [s] | Relative | |:---|---:|---:|---:|---:| | `result-asserts/bin/nix --extra-experimental-features 'nix-command flakes' eval --raw --impure --expr 'with import <nixpkgs/nixos> {}; system'` | 5.838 ± 0.023 | 5.799 | 5.867 | 1.01 ± 0.01 | | `result/bin/nix --extra-experimental-features 'nix-command flakes' eval --raw --impure --expr 'with import <nixpkgs/nixos> {}; system'` | 5.788 ± 0.044 | 5.715 | 5.876 | 1.00 | | Command | Mean [s] | Min [s] | Max [s] | Relative | |:---|---:|---:|---:|---:| | `result-asserts/bin/nix --extra-experimental-features 'nix-command flakes' search --no-eval-cache github:nixos/nixpkgs/e1fa12d4f6c6fe19ccb59cac54b5b3f25e160870 hello` | 15.993 ± 0.081 | 15.829 | 16.096 | 1.01 ± 0.01 | | `result/bin/nix --extra-experimental-features 'nix-command flakes' search --no-eval-cache github:nixos/nixpkgs/e1fa12d4f6c6fe19ccb59cac54b5b3f25e160870 hello` | 15.897 ± 0.075 | 15.807 | 16.047 | 1.00 | Fixes: https://git.lix.systems/lix-project/lix/issues/4 Change-Id: Id3a6f38274ba94d5d10b09edd19dfd96bc3e7d5f
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build9
1 files changed, 7 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index 2cedabad5..456be5aa2 100644
--- a/meson.build
+++ b/meson.build
@@ -344,6 +344,12 @@ add_project_arguments(
'-Wimplicit-fallthrough',
'-Werror=switch',
'-Werror=switch-enum',
+ # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked
+ # at ~1% overhead in `nix search`.
+ #
+ # FIXME: remove when we get meson 1.4.0 which will default this to on for us:
+ # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions
+ '-D_GLIBCXX_ASSERTIONS=1',
language : 'cpp',
)
@@ -351,8 +357,7 @@ if cxx.get_id() in ['gcc', 'clang']
# 2024-03-24: jade benchmarked the default sanitize reporting in clang and got
# a regression of about 10% on hackage-packages.nix with clang. So we are trapping instead.
#
- # This has an overhead of 0-4% on gcc and unmeasurably little on clang, in
- # Nix evaluation benchmarks.
+ # This has an unmeasurably low overhead in Nix evaluation benchmarks.
#
# N.B. Meson generates a completely nonsense warning here:
# https://github.com/mesonbuild/meson/issues/9822