[Differential] [Closed] D31: revlog: micro-optimize the computation of hashes

alex_gaynor (Alex Gaynor) phabricator at mercurial-scm.org
Fri Jul 14 16:33:46 UTC 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG943b8c37f49d: revlog: micro-optimize the computation of hashes (authored by alex_gaynor).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D31?vs=47&id=132

REVISION DETAIL
  https://phab.mercurial-scm.org/D31

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

Index: mercurial/revlog.py
===================================================================
--- mercurial/revlog.py
+++ mercurial/revlog.py
@@ -152,10 +152,14 @@
         s.update(p1)
     else:
         # none of the parent nodes are nullid
-        l = [p1, p2]
-        l.sort()
-        s = hashlib.sha1(l[0])
-        s.update(l[1])
+        if p1 < p2:
+            a = p1
+            b = p2
+        else:
+            a = p2
+            b = p1
+        s = hashlib.sha1(a)
+        s.update(b)
     s.update(text)
     return s.digest()
 


EMAIL PREFERENCES
  https://phab.mercurial-scm.org/settings/panel/emailpreferences/

To: alex_gaynor, durin42
Cc: quark, dsp, mercurial-devel


More information about the Mercurial-devel mailing list