# HG changeset patch # User Jun Wu # Date 1533687421 25200 # 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 -r 1601afbb573c -r 32b1967b8734 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