# HG changeset patch # User Pierre-Yves David # Date 1417073013 28800 # 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 -r ac910b1f5658 -r b46876c94a93 mercurial/obsolete.py --- a/mercurial/obsolete.py Wed Nov 26 23:21:20 2014 -0800 +++ b/mercurial/obsolete.py Wed Nov 26 23:23:33 2014 -0800 @@ -276,6 +276,8 @@ _fm1fixed = '>IdhHBBB20s' _fm1nodesha1 = '20s' _fm1nodesha256 = '32s' +_fm1nodesha1size = _calcsize(_fm1nodesha1) +_fm1nodesha256size = _calcsize(_fm1nodesha256) _fm1fsize = _calcsize(_fm1fixed) _fm1parentnone = 3 _fm1parentshift = 14 @@ -298,9 +300,10 @@ # 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: