Mercurial > public > mercurial-scm > hg
comparison mercurial/linelog.py @ 38970:32b1967b8734
linelog: extract `len(self._program)` to a local function
This is a micro optimization prepared for following changes where
`len(self._program)` is used in a loop.
Differential Revision: https://phab.mercurial-scm.org/D4149
author | Jun Wu <quark@fb.com> |
---|---|
date | Tue, 07 Aug 2018 17:17:01 -0700 |
parents | 70a19e804deb |
children | ee97f7a677f3 |
comparison
equal
deleted
inserted
replaced
38969:1601afbb573c | 38970:32b1967b8734 |
---|---|
306 a1inst = _eof(0, 0) | 306 a1inst = _eof(0, 0) |
307 a1info = lineinfo(0, 0, ar._eof) | 307 a1info = lineinfo(0, 0, ar._eof) |
308 else: | 308 else: |
309 a1info = ar.lines[a1] | 309 a1info = ar.lines[a1] |
310 a1inst = self._program[a1info._offset] | 310 a1inst = self._program[a1info._offset] |
311 oldproglen = len(self._program) | 311 programlen = self._program.__len__ |
312 oldproglen = programlen() | |
312 appendinst = self._program.append | 313 appendinst = self._program.append |
313 | 314 |
314 # insert | 315 # insert |
315 if b1 < b2: | 316 if b1 < b2: |
316 # Determine the jump target for the JGE at the start of | 317 # Determine the jump target for the JGE at the start of |