From: JINMEI Tatuya Date: Wed, 9 May 2012 20:54:03 +0000 (-0700) Subject: [1805] minor optimization: check nsec_signed first in getClosestNSEC(). X-Git-Tag: trac2351_base~226^2~158^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=32bb3f9e17a9c3c2bbc50b4239ee8463f9216299;p=thirdparty%2Fkea.git [1805] minor optimization: check nsec_signed first in getClosestNSEC(). in practice the DNSSEC option is provided in many cases, considering the common default behavior of widely deployed resolvers, while not many zones are actually not signed at all in the first place (much less whether it's NSEC or NSEC3). so in many cases we should simply be able to stop the condition check with the nsec_signed. --- diff --git a/src/lib/datasrc/memory_datasrc.cc b/src/lib/datasrc/memory_datasrc.cc index 1e5b4ecf9e..1d026caf71 100644 --- a/src/lib/datasrc/memory_datasrc.cc +++ b/src/lib/datasrc/memory_datasrc.cc @@ -251,7 +251,7 @@ ConstRBNodeRRsetPtr ZoneData::getClosestNSEC(RBTreeNodeChain& node_path, ZoneFinder::FindOptions options) const { - if ((options & ZoneFinder::FIND_DNSSEC) == 0 || !nsec_signed_) { + if (!nsec_signed_ || (options & ZoneFinder::FIND_DNSSEC) == 0) { return (ConstRBNodeRRsetPtr()); }