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