Mercurial > hg-stable
diff mercurial/mdiff.py @ 15530:eeac5e179243
mdiff: replace wscleanup() regexps with C loops
On my system it reduces:
hg annotate -w mercurial/commands.py
from 36s to less than 8s, to be compared with 6.3s when run without whitespace
options.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 18 Nov 2011 14:23:03 +0100 |
parents | b35cf47286a6 |
children | d976b1ef6760 |
line wrap: on
line diff
--- a/mercurial/mdiff.py Fri Nov 18 14:16:47 2011 +0100 +++ b/mercurial/mdiff.py Fri Nov 18 14:23:03 2011 +0100 @@ -67,10 +67,9 @@ def wsclean(opts, text, blank=True): if opts.ignorews: - text = re.sub('[ \t\r]+', '', text) + text = bdiff.fixws(text, 1) elif opts.ignorewsamount: - text = re.sub('[ \t\r]+', ' ', text) - text = text.replace(' \n', '\n') + text = bdiff.fixws(text, 0) if blank and opts.ignoreblanklines: text = re.sub('\n+', '\n', text).strip('\n') return text