]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: reorder fields of record cache entry by size (saves 8 bytes per entry on 64... 15950/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 29 Jul 2025 14:25:09 +0000 (16:25 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 30 Jul 2025 08:46:46 +0000 (10:46 +0200)
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
pdns/recursordist/recursor_cache.hh

index 004b0c196530166b4e067a675cb64b7866ec4529..db4e6d90dea2b027f0767ddaf03d262cfad25854 100644 (file)
@@ -133,7 +133,11 @@ private:
   struct CacheEntry
   {
     CacheEntry(const std::tuple<DNSName, QType, OptTag, Netmask>& key, bool auth) :
-      d_qname(std::get<0>(key)), d_netmask(std::get<3>(key).getNormalized()), d_rtag(std::get<2>(key)), d_qtype(std::get<1>(key)), d_auth(auth)
+      d_rtag(std::get<2>(key)),
+      d_netmask(std::get<3>(key).getNormalized()),
+      d_qname(std::get<0>(key)),
+      d_qtype(std::get<1>(key)),
+      d_auth(auth)
     {
     }
 
@@ -160,22 +164,22 @@ private:
     [[nodiscard]] size_t authRecsSizeEstimate() const;
     [[nodiscard]] size_t sigRecsSizeEstimate() const;
 
-    records_t d_records;
-    SigRecs d_signatures;
-    AuthRecs d_authorityRecs;
-    DNSName d_qname;
-    DNSName d_authZone;
-    ComboAddress d_from;
-    Netmask d_netmask;
-    OptTag d_rtag;
-    mutable vState d_state{vState::Indeterminate};
-    mutable time_t d_ttd{0};
-    uint32_t d_orig_ttl{0};
-    mutable uint16_t d_servedStale{0};
-    QType d_qtype;
-    bool d_auth;
-    mutable bool d_submitted{false}; // whether this entry has been queued for refetch
-    bool d_tooBig{false};
+    OptTag d_rtag; // 40 (sizes for typical 64 bit system)
+    Netmask d_netmask; // 36
+    ComboAddress d_from; // 28
+    records_t d_records; // 24
+    DNSName d_qname; // 24
+    DNSName d_authZone; // 24
+    SigRecs d_signatures; // 16
+    AuthRecs d_authorityRecs; // 16
+    mutable time_t d_ttd{0}; // 8
+    uint32_t d_orig_ttl{0}; // 4
+    mutable uint16_t d_servedStale{0}; // 2
+    QType d_qtype; // 2
+    mutable vState d_state{vState::Indeterminate}; // 1
+    bool d_auth; // 1
+    mutable bool d_submitted{false}; // 1, whether this entry has been queued for refetch
+    bool d_tooBig{false}; // 1
   };
 
   bool replace(CacheEntry&& entry);