Hi,
Maybe I overlooked something, but it seems that passing 2 arguments to
seq_sequences_iter() is not needed.
Patch attached.
Cheers,
Piotr
Kai Willadsen wrote:
Hi all,
In Differ, merged diffs are repeatedly calculated whenever we iterate
over changes. The merged versions of diffs can theoretically differ,
as the underlying text is passed in on each call. However, this text
always ends up being the raw file text, and we always update our diffs
whenever this text changes. As such, we can cache the merged version
of our diffs by disallowing the effectively unused texts argument.
I'm attaching two patches, the first of which implements this caching
of merged diffs, and the second of which provides a short-circuit for
two-way comparisons. On two-way diffs, these patches provide a very
slight speed improvement; on three-way diffs, the speed-up is easily
measurable -- around 5% in a few quick tests based on scrolling
through a three-way source file comparison.
Comments appreciated.
cheers,
Kai
------------------------------------------------------------------------
_______________________________________________
meld-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/meld-list
>From 7946d01f45df9af20fb15d559fefee9b88d7d2de Mon Sep 17 00:00:00 2001
From: Piotr Piastucki <[email protected]>
Date: Tue, 14 Jul 2009 18:46:47 +0200
Subject: [PATCH] Remove texts from set_sequences_iter arguments
---
diffutil.py | 4 ++--
filediff.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/diffutil.py b/diffutil.py
index 3da1c1a..08b8470 100644
--- a/diffutil.py
+++ b/diffutil.py
@@ -248,7 +248,7 @@ class Differ(object):
for c in self._auto_merge(using, texts):
yield c
- def set_sequences_iter(self, sequences, texts):
+ def set_sequences_iter(self, sequences):
assert 0 <= len(sequences) <= 3
self.diffs = [[], []]
self.num_sequences = len(sequences)
@@ -260,6 +260,6 @@ class Differ(object):
while work.next() == None:
yield None
self.diffs[i] = matcher.get_difference_opcodes()
- self._update_merge_cache(texts)
+ self._update_merge_cache(sequences)
yield 1
diff --git a/filediff.py b/filediff.py
index 5e9441b..acc1546 100644
--- a/filediff.py
+++ b/filediff.py
@@ -591,7 +591,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
yield _("[%s] Computing differences") % self.label_text
panetext = [self._filter_text(p) for p in panetext]
lines = map(lambda x: x.split("\n"), panetext)
- step = self.linediffer.set_sequences_iter(lines, self._get_texts())
+ step = self.linediffer.set_sequences_iter(lines)
while step.next() == None:
yield 1
--
1.6.0.4
_______________________________________________
meld-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/meld-list