From: Remi Gacogne Date: Tue, 11 Jun 2019 12:47:53 +0000 (+0200) Subject: rec: Compare the CacheKey type and place first then the name X-Git-Tag: rec-4.2.0-rc2~3^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F7939%2Fhead;p=thirdparty%2Fpdns.git rec: Compare the CacheKey type and place first then the name 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. (cherry picked from commit 186e99c98d195329af05129cd4d6512657edf4bc) --- diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 8e8f747b1c..148ee84b86 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -1111,7 +1111,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 tcache_t;