Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnsdist: Replace shared by unique ptrs, reduce structs size #10846

Merged

Conversation

rgacogne
Copy link
Member

Short description

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

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

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
@rgacogne rgacogne merged commit 834570e into PowerDNS:master Oct 15, 2021
@rgacogne rgacogne deleted the ddist-shared-to-unique-structs-size branch October 15, 2021 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant