# HG changeset patch # User Pierre-Yves David # Date 2014-11-27 07:23:33 # Node ID b46876c94a935f570ac915ff3d345583c42989bd # Parent ac910b1f5658d2cac91c60dccb6e459391eec44a obsstore: cache size computation for fm1 node We have two different types of node type (sha1 and sha256, only sha1 is used now) and therefor different sizes for them. We now compute the value once instead of redoing the computation every loop. This has no visible performance impact. diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -276,6 +276,8 @@ def _fm0decodemeta(data): _fm1fixed = '>IdhHBBB20s' _fm1nodesha1 = '20s' _fm1nodesha256 = '32s' +_fm1nodesha1size = _calcsize(_fm1nodesha1) +_fm1nodesha256size = _calcsize(_fm1nodesha256) _fm1fsize = _calcsize(_fm1fixed) _fm1parentnone = 3 _fm1parentshift = 14 @@ -298,9 +300,10 @@ def _fm1readmarkers(data, off=0): # build the date tuple (upgrade tz minutes to seconds) date = (seconds, tz * 60) _fm1node = _fm1nodesha1 + fnodesize = _fm1nodesha1size if flags & usingsha256: _fm1node = _fm1nodesha256 - fnodesize = _calcsize(_fm1node) + fnodesize = _fm1nodesha256size # read replacement sucs = () if numsuc: