# HG changeset patch # User Jun Wu # Date 2018-08-08 00:17:01 # Node ID 32b1967b873445ac215ea3f381075dcf51a10f29 # Parent 1601afbb573c771c5943256debe3c36718f4c6d4 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 diff --git a/mercurial/linelog.py b/mercurial/linelog.py --- a/mercurial/linelog.py +++ b/mercurial/linelog.py @@ -308,7 +308,8 @@ class linelog(object): 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