From patchwork Fri Aug 3 13:44:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D4027: revlog: remove micro-optimization for looking up only nullid From: phabricator X-Patchwork-Id: 33145 Message-Id: <35b57008ddd1a77fec7ffe3a3897bc76@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Fri, 3 Aug 2018 13:44:44 +0000 This revision was automatically updated to reflect the committed changes. Closed by commit rHG44bbc89ec5e0: revlog: remove micro-optimization for looking up only nullid (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4027?vs=9727&id=9821 REVISION DETAIL https://phab.mercurial-scm.org/D4027 AFFECTED FILES mercurial/cext/revlog.c CHANGE DETAILS To: martinvonz, #hg-reviewers Cc: mercurial-devel diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c --- a/mercurial/cext/revlog.c +++ b/mercurial/cext/revlog.c @@ -994,9 +994,6 @@ if (nodelen == 20 && node[0] == '\0' && memcmp(node, nullid, 20) == 0) return -1; - if (self->nt == NULL) - return -2; - if (hex) maxlevel = nodelen > 40 ? 40 : (int)nodelen; else @@ -1133,14 +1130,14 @@ { int rev; + if (nt_init(self) == -1) + return -3; + self->ntlookups++; rev = nt_find(self, node, nodelen, 0); if (rev >= -1) return rev; - if (nt_init(self) == -1) - return -3; - /* * For the first handful of lookups, we scan the entire index, * and cache only the matching nodes. This optimizes for cases