From: Willy Tarreau Date: Mon, 30 Nov 2026 18:55:00 +0000 (+0100) Subject: CLEANUP: sample: reduce struct sample by filling a hole X-Git-Url: https://git.kaiwu.me/http/%22../$%7BGITURL%7D/static//%22?a=commitdiff_plain;h=86f7020d1caf9b4e3eff892d0bd875fe101cf263;p=haproxy.git CLEANUP: sample: reduce struct sample by filling a hole The struct sample keeps a 32-bit hole at the beggining after the flags, and ends up with a 32-bit member (opt) that imposes extra padding. Let's just move opt into the hole and reduce it from 152 to 144 bytes. That counts more than it seems because a lot of expression processing creates copies of samples or memset() them (e.g. in every pattern match in ACLs). --- diff --git a/include/haproxy/sample-t.h b/include/haproxy/sample-t.h index 631959558..6d3f92b1f 100644 --- a/include/haproxy/sample-t.h +++ b/include/haproxy/sample-t.h @@ -248,6 +248,7 @@ union smp_ctx { */ struct sample { unsigned int flags; /* SMP_F_* */ + unsigned int opt; /* fetch options (SMP_OPT_*) */ struct sample_data data; union smp_ctx ctx; @@ -259,7 +260,6 @@ struct sample { struct proxy *px; struct session *sess; struct stream *strm; /* WARNING! MAY BE NULL! (eg: tcp-request connection) */ - unsigned int opt; /* fetch options (SMP_OPT_*) */ }; /* Descriptor for a sample conversion */