Mercurial > hg > mercurial-source
changeset 23802:48284b8f6073
readmarkers: drop temporary substring assignments
Assignments are expensive in inner loops
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 10 Jan 2015 21:24:45 -0600 |
parents | 94951db84fc0 |
children | 2e58b062aa35 |
files | mercurial/obsolete.py |
diffstat | 1 files changed, 4 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -290,9 +290,8 @@ l = len(data) while off + _fm1fsize <= l: # read fixed part - cur = data[off:off + _fm1fsize] + fixeddata = _unpack(_fm1fixed, data[off:off + _fm1fsize]) off += _fm1fsize - fixeddata = _unpack(_fm1fixed, cur) ttsize, seconds, tz, flags, numsuc, numpar, nummeta, prec = fixeddata # extract the number of parents information if numpar == _fm1parentnone: @@ -308,8 +307,7 @@ sucs = () if numsuc: s = (fnodesize * numsuc) - cur = data[off:off + s] - sucs = _unpack(_fm1node * numsuc, cur) + sucs = _unpack(_fm1node * numsuc, data[off:off + s]) off += s # read parents if numpar is None: @@ -318,8 +316,7 @@ parents = () elif numpar: # neither None nor zero s = (fnodesize * numpar) - cur = data[off:off + s] - parents = _unpack(_fm1node * numpar, cur) + parents = _unpack(_fm1node * numpar, data[off:off + s]) off += s # read metadata metaformat = '>' + (_fm1metapair * nummeta) @@ -330,11 +327,7 @@ for idx in xrange(0, len(metapairsize), 2): sk = metapairsize[idx] sv = metapairsize[idx + 1] - key = data[off:off + sk] - value = data[off + sk:off + sk + sv] - assert len(key) == sk - assert len(value) == sv - metadata.append((key, value)) + metadata.append((data[off:off + sk], data[off + sk:off + sk + sv])) off += sk + sv metadata = tuple(metadata)