# HG changeset patch # User Alex Gaynor # Date 1499719168 14400 # Node ID 943b8c37f49d80173d14b3a2025095d83f425932 # Parent 32331f54930cebd2baf953506971953a588491b4 revlog: micro-optimize the computation of hashes Differential Revision: https://phab.mercurial-scm.org/D31 diff -r 32331f54930c -r 943b8c37f49d mercurial/revlog.py --- a/mercurial/revlog.py Mon Jul 03 13:49:03 2017 +0200 +++ b/mercurial/revlog.py Mon Jul 10 16:39:28 2017 -0400 @@ -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()