changeset 37568:f5833651ad07

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.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 09 Apr 2018 20:49:39 +0900
parents 53021c4ef0b2
children 2025bf60adb2
files mercurial/patch.py
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Mon Apr 09 20:47:43 2018 +0900
+++ b/mercurial/patch.py	Mon Apr 09 20:49:39 2018 +0900
@@ -33,20 +33,19 @@
     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/(.*)')