linelog: extract `len(self._program)` to a local function
authorJun Wu <quark@fb.com>
Tue, 07 Aug 2018 17:17:01 -0700
changeset 38970 32b1967b8734
parent 38969 1601afbb573c
child 38971 ee97f7a677f3
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
mercurial/linelog.py
--- a/mercurial/linelog.py	Mon Aug 06 18:56:24 2018 -0700
+++ b/mercurial/linelog.py	Tue Aug 07 17:17:01 2018 -0700
@@ -308,7 +308,8 @@
         else:
             a1info = ar.lines[a1]
             a1inst = self._program[a1info._offset]
-        oldproglen = len(self._program)
+        programlen = self._program.__len__
+        oldproglen = programlen()
         appendinst = self._program.append
 
         # insert