On Fri, 2025-09-05 at 13:25 -0700, Jeff Davis wrote: > As an aside, I'm building with meson using -Dc_args="-msse4.2 -Wtype- > limits -Werror=missing-braces". But I notice that the meson build > doesn't seem to use -funroll-loops or -ftree-vectorize when building > checksums.c. Is that intentional? If not, perhaps slower checksum > calculations explain my results.
Attached a patch. I'm not sure if it's the right way to do things, but the resulting compiler command seems right to me. It doesn't affect my tests in this thread much, but it seems best to be consistent with autoconf. Regards, Jeff Davis
From d714e93aa7d2493e394659142bbd3f378aa0f050 Mon Sep 17 00:00:00 2001 From: Jeff Davis <j...@j-davis.com> Date: Fri, 5 Sep 2025 15:41:35 -0700 Subject: [PATCH v1] meson: build checksums with extra optimization flags. Use -funroll-loops and -ftree-vectorize when building checksum.c to match what autoconf does. Discussion: https://postgr.es/m/a81f2f7ef34afc24a89c613671ea017e3651329c.ca...@j-davis.com --- src/backend/storage/page/meson.build | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/backend/storage/page/meson.build b/src/backend/storage/page/meson.build index c3e4a805862..112f00ff365 100644 --- a/src/backend/storage/page/meson.build +++ b/src/backend/storage/page/meson.build @@ -1,7 +1,15 @@ # Copyright (c) 2022-2025, PostgreSQL Global Development Group +checksum_backend_lib = static_library('checksum_backend_lib', + 'checksum.c', + dependencies: backend_build_deps, + kwargs: internal_lib_args, + c_args: vectorize_cflags + unroll_loops_cflags, +) + +backend_link_with += checksum_backend_lib + backend_sources += files( 'bufpage.c', - 'checksum.c', 'itemptr.c', ) -- 2.43.0