]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Replace shared by unique ptrs, reduce structs size
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 14 Oct 2021 08:41:58 +0000 (10:41 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 14 Oct 2021 08:41:58 +0000 (10:41 +0200)
commit73571c03409ab29bacba4dbb52720a549da241a5
tree53c17b55ed29511938d9e9ad1c39b59fbb5f9dc3
parent4423b6d4eebbeddd6d072bb03c9ab9170e48f67f
dnsdist: Replace shared by unique ptrs, reduce structs size

This commit replaces the DNSCrypt and QTaq shared pointers by unique ones,
since these are not actually shared. This should improve performance a
bit since we no longer need to clear a cache line for the reference
counter. It also reduces the size of the IDState and DNSQuestion structures
by a few bytes.
It also removes a few fields in the DOHUnit structure that are redundant
with ones in the embedded IDState structure.
The rest of the commit re-order fields in various structures to prevent
wasted space due to padding, reducing the memory footprint of these structs.

On x86_64 (in bytes):

IDState 344 -> 328
DOHUnit 712 -> 632
TCPQuery 416 -> 400
IncomingTCPConnectionState 968 -> 944
TCPConnectionToBackend 728 -> 712
DownstreamState 2368 -> 2240
14 files changed:
pdns/dnsdist-dnscrypt.cc
pdns/dnsdist-idstate.hh
pdns/dnsdist-tcp.cc
pdns/dnsdist.cc
pdns/dnsdist.hh
pdns/dnsdistdist/dnsdist-backend.cc
pdns/dnsdistdist/dnsdist-idstate.cc
pdns/dnsdistdist/dnsdist-nghttp2.cc
pdns/dnsdistdist/dnsdist-tcp-downstream.hh
pdns/dnsdistdist/dnsdist-tcp-upstream.hh
pdns/dnsdistdist/dnsdist-tcp.hh
pdns/dnsdistdist/doh.cc
pdns/dnsdistdist/test-dnsdisttcp_cc.cc
pdns/doh.hh