From: Andrew Nelless Date: Fri, 12 Feb 2016 22:42:30 +0000 (+0000) Subject: Shrink PacketID by 10% by eliminating padding. X-Git-Tag: auth-4.0.0-alpha2~60^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=91ffe057439e1e6737c7e565deb2a4e413f43f55;p=thirdparty%2Fpdns.git Shrink PacketID by 10% by eliminating padding. PacketID is bloated. Some minor reordering, which shouldn't effect locality, reduces sizeof(PacketID) from 232 to 208 bytes compiled against GNU libstdc++ (shipped with GCC 5.3, C++11 ABI) and from 184 to 160 bytes against libc++ 3.7.0. In both cases only 3 bytes of padding remain for aligning 'bool inIncompleteOkay'. --- diff --git a/pdns/syncres.hh b/pdns/syncres.hh index 9473966a42..5ed097e9eb 100644 --- a/pdns/syncres.hh +++ b/pdns/syncres.hh @@ -513,21 +513,21 @@ struct PacketID } uint16_t id; // wait for a specific id/remote pair + uint16_t type; // and this is its type ComboAddress remote; // this is the remote DNSName domain; // this is the question - uint16_t type; // and this is its type Socket* sock; // or wait for an event on a TCP fd - int inNeeded; // if this is set, we'll read until inNeeded bytes are read string inMSG; // they'll go here + int inNeeded; // if this is set, we'll read until inNeeded bytes are read bool inIncompleteOkay; string outMSG; // the outgoing message that needs to be sent string::size_type outPos; // how far we are along in the outMSG - mutable uint32_t nearMisses; // number of near misses - host correct, id wrong typedef set chain_t; mutable chain_t chain; + mutable uint32_t nearMisses; // number of near misses - host correct, id wrong int fd; bool operator<(const PacketID& b) const