changeset 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 1601afbb573c
children ee97f7a677f3
files mercurial/linelog.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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