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: dnsdist-1.4.0-rc1~144^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F7905%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. --- diff --git a/pdns/syncres.cc b/pdns/syncres.cc index dcdcc1ce0b..baca8d53dd 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -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 tcache_t;