[diffoscope] 02/02: diffoscope.diff: Alias expensive Config() lookup for a 10% optimisation on my test case.

Chris Lamb chris at chris-lamb.co.uk
Tue Jan 3 18:06:15 CET 2017


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository diffoscope.

commit d96ac53fbf9ae90351973dc8d78f6c0cf890163d
Author: Chris Lamb <lamby at debian.org>
Date:   Tue Jan 3 17:03:20 2017 +0000

    diffoscope.diff: Alias expensive Config() lookup for a 10% optimisation on my test case.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/diff.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/diffoscope/diff.py b/diffoscope/diff.py
index 779ca0a..011916a 100644
--- a/diffoscope/diff.py
+++ b/diffoscope/diff.py
@@ -53,6 +53,7 @@ class DiffParser(object):
         self._block_len = None
         self._direction = None
         self._end_nl = None
+        self._max_lines = Config().max_diff_block_lines_saved
 
     @property
     def diff(self):
@@ -130,9 +131,8 @@ class DiffParser(object):
             else:
                 self._block_len = 1
                 self._direction = line[0]
-            max_lines = Config().max_diff_block_lines_saved
 
-            if self._block_len >= max_lines:
+            if self._block_len >= self._max_lines:
                 return self.skip_block
         else:
             self._block_len = 1

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list