Mercurial > hg
changeset 33391:943b8c37f49d
revlog: micro-optimize the computation of hashes
Differential Revision: https://phab.mercurial-scm.org/D31
author | Alex Gaynor <agaynor@mozilla.com> |
---|---|
date | Mon, 10 Jul 2017 16:39:28 -0400 |
parents | 32331f54930c |
children | ac6446611ad2 |
files | mercurial/revlog.py |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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()