]> git.ipfire.org Git - thirdparty/systemd.git/commit
resolved: rearrange DnsResourceRecord for better layout
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 14 May 2021 15:15:53 +0000 (17:15 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 14 May 2021 15:15:53 +0000 (17:15 +0200)
commita6e890d4935b27f35c2171c9e2998a73606fa7bd
tree807b71bf60c9889cb7c760d4f7b780761a5c3661
parent98e80bf9d2f069e58283a74a6cfd8bf69578af31
resolved: rearrange DnsResourceRecord for better layout

The structure is rearranged to have less holes. Also fields in the union
are rearranged not to have holes (though most variants of the union still
have some padding at the end).

The full size does not decrease a lot, but the compiler should be able to
copy less bytes when it knows the specific type of the union.

Bitfields are dropped because they don't give any memory savings due to
alignment requirements (but would still require more complex to access).

The change from the this and previous commit:
/* size: 128, cachelines: 2, members: 13 */
/* sum members: 112, holes: 3, sum holes: 15 */
/* sum bitfield members: 2 bits, bit holes: 1, sum bit holes: 6 bits */
     ↓
/* size: 112, cachelines: 2, members: 13 */
/* sum members: 108, holes: 1, sum holes: 4 */
src/resolve/resolved-dns-rr.h