# HG changeset patch # User Yuya Nishihara <y...@tcha.org> # Date 1523274579 -32400 # Mon Apr 09 20:49:39 2018 +0900 # Node ID 2d521734ec51a8dbf99c77fd0c2242669c7b5109 # Parent 35a82b6cd55528b0aa0028321c69756d41175b54 patch: stop using cext.diffhelpers
The C implementation has a couple of memory bugs, and lacks error handling which could lead to SEGV. I could fix them one by one (and I mostly finished that), but the performance gain provided by cext.diffhelper is quite low. Besides, diffhelpers.addlines() calls back Python, linereader.readline(), from the innermost loop. $ hg export -R mozilla-central 0:100 > patch $ ls -lh patch -rw-r--r-- 184M patch $ hg init repo && hg -R repo import patch --time --bypass (cext) time: real 34.970 secs (user 32.720+0.000 sys 2.230+0.000) (pure) time: real 35.950 secs (user 33.600+0.000 sys 2.330+0.000) So, let's simply use the pure Python implementation. diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -33,20 +33,19 @@ from . import ( mail, mdiff, pathutil, - policy, pycompat, scmutil, similar, util, vfs as vfsmod, ) +from .pure import diffhelpers from .utils import ( dateutil, procutil, stringutil, ) -diffhelpers = policy.importmod(r'diffhelpers') stringio = util.stringio gitre = re.compile(br'diff --git a/(.*) b/(.*)') _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel