From: Peter van Dijk Date: Tue, 2 May 2023 12:02:33 +0000 (+0200) Subject: simplify oldestts checking, optimise hot path for non-LS users X-Git-Tag: auth-4.8.0-beta1~1^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61f7077570c70f5a192ec705123a6237261c4a4a;p=thirdparty%2Fpdns.git simplify oldestts checking, optimise hot path for non-LS users --- diff --git a/ext/lmdb-safe/lmdb-typed.hh b/ext/lmdb-safe/lmdb-typed.hh index c83ed39859..a48c3af010 100644 --- a/ext/lmdb-safe/lmdb-typed.hh +++ b/ext/lmdb-safe/lmdb-typed.hh @@ -676,16 +676,17 @@ public: uint64_t ts = LMDBLS::LSgetTimestamp(id.getNoStripHeader()); uint32_t __id = _id.getNoStripHeader(); - if (ts < oldestts) { - oldestts = ts; - oldestid = __id; + if (onlyOldest) { + if (ts < oldestts) { + oldestts = ts; + oldestid = __id; + + ids.clear(); + ids.push_back(oldestid); + } + } else { + ids.push_back(__id); } - ids.push_back(__id); - } - - if (onlyOldest && ids.size() > 1) { - ids.clear(); - ids.push_back(oldestid); } rc = cursor.get(out, id, MDB_NEXT);