[Git][reproducible-builds/diffoscope][master] 4 commits: Profile calls to specialize.
Chris Lamb (@lamby)
gitlab at salsa.debian.org
Tue Aug 17 14:51:46 UTC 2021
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
5e80c6ab by Chris Lamb at 2021-08-17T14:35:44+01:00
Profile calls to specialize.
- - - - -
c907d472 by Chris Lamb at 2021-08-17T14:35:44+01:00
Print the size of generated reports if possible.
- - - - -
653fb1bf by Chris Lamb at 2021-08-17T15:46:54+01:00
Profile diffoscope.diff.linediff.
- - - - -
15938a18 by Chris Lamb at 2021-08-17T15:51:25+01:00
Reduce the maximum line length for caclulating Wagner-Fischer. (Closes: reproducible-builds/diffoscope#272)
- - - - -
3 changed files:
- diffoscope/comparators/utils/compare.py
- diffoscope/diff.py
- diffoscope/presenters/formats.py
Changes:
=====================================
diffoscope/comparators/utils/compare.py
=====================================
@@ -93,8 +93,9 @@ def compare_files(file1, file2, source=None, diff_content_only=False):
# Specialize the files first so "has_same_content_as" can be overridden
# by subclasses
- specialize(file1)
- specialize(file2)
+ with profile("specialize", "specialize"):
+ specialize(file1)
+ specialize(file2)
force_details = Config().force_details
with profile("has_same_content_as", file1):
=====================================
diffoscope/diff.py
=====================================
@@ -32,6 +32,7 @@ from multiprocessing.dummy import Queue
from .tools import get_tool_name, tool_required
from .config import Config
+from .profiling import profile
from .tempfiles import get_temporary_directory
DIFF_CHUNK = 4096
@@ -386,7 +387,7 @@ def color_unified_diff(diff):
DIFFON = "\x01"
DIFFOFF = "\x02"
MAX_WAGNER_FISCHER_SIZE = (
- 1024 # any higher, and linediff takes >1 second and >200MB RAM
+ 256 # any higher, and linediff takes >1 second and >200MB RAM
)
@@ -450,6 +451,7 @@ def linediff_wagnerfischer(s, t):
for j in range(1, n + 1):
d[0][j] = (j, (0, j - 1))
+ # NB. This loop is O(len(s) * len(t))
for i in range(1, m + 1):
for j in range(1, n + 1):
if s[i - 1] == t[j - 1]:
@@ -611,7 +613,8 @@ class SideBySideDiff:
type_name = "unmodified"
else:
type_name = "changed"
- s1, s2 = linediff(s1, s2, self.diffon, self.diffoff)
+ with profile("diff", "linediff"):
+ s1, s2 = linediff(s1, s2, self.diffon, self.diffoff)
yield "L", (type_name, s1, self.line1, s2, self.line2)
=====================================
diffoscope/presenters/formats.py
=====================================
@@ -16,9 +16,11 @@
# You should have received a copy of the GNU General Public License
# along with diffoscope. If not, see <https://www.gnu.org/licenses/>.
+import os
import logging
from ..profiling import profile
+from ..utils import format_bytes
from .text import TextPresenter
from .json import JSONPresenter
@@ -102,6 +104,17 @@ class PresenterManager:
with profile("output", name):
data["klass"].run(data, difference, parsed_args)
+ size = "n/a"
+ if os.path.isfile(data["target"]):
+ size = format_bytes(os.path.getsize(data["target"]))
+
+ logger.debug(
+ "Generated %r output at %r (size: %s)",
+ name,
+ data["target"],
+ size,
+ )
+
def compute_visual_diffs(self):
"""
Don't waste time computing visual differences if we won't use them.
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/ab780bf6ad6bfa0c88767827065d3fdba4fd3b32...15938a1887e8226e381d1636c251f9cd69e583b5
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/ab780bf6ad6bfa0c88767827065d3fdba4fd3b32...15938a1887e8226e381d1636c251f9cd69e583b5
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20210817/76598347/attachment.htm>
More information about the rb-commits
mailing list