]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Compare the CacheKey type and place first then the name 7905/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 11 Jun 2019 12:47:53 +0000 (14:47 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 11 Jun 2019 12:47:53 +0000 (14:47 +0200)
We don't care about the actual ordering, so let's do the cheapest
comparisons first then the quite expensive DNSName comparison only
if we really need to.

pdns/syncres.cc

index dcdcc1ce0ba9ac811186099f3d2ddbff4c7080fc..baca8d53dd24ec08aae9873cd6d125e841994b59 100644 (file)
@@ -1106,7 +1106,7 @@ struct CacheKey
   uint16_t type;
   DNSResourceRecord::Place place;
   bool operator<(const CacheKey& rhs) const {
-    return tie(name, type, place) < tie(rhs.name, rhs.type, rhs.place);
+    return tie(type, place, name) < tie(rhs.type, rhs.place, rhs.name);
   }
 };
 typedef map<CacheKey, CacheEntry> tcache_t;