comparison tests/test-bdiff.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 4c50552fc9bc
children 2e54aaa65afc
comparison
equal deleted inserted replaced
15529:b35cf47286a6 15530:eeac5e179243
48 pos += l 48 pos += l
49 showdiff("x\n\nx\n\nx\n\nx\n\nz\n", "x\n\nx\n\ny\n\nx\n\nx\n\nz\n") 49 showdiff("x\n\nx\n\nx\n\nx\n\nz\n", "x\n\nx\n\ny\n\nx\n\nx\n\nz\n")
50 showdiff("x\n\nx\n\nx\n\nx\n\nz\n", "x\n\nx\n\ny\n\nx\n\ny\n\nx\n\nz\n") 50 showdiff("x\n\nx\n\nx\n\nx\n\nz\n", "x\n\nx\n\ny\n\nx\n\ny\n\nx\n\nz\n")
51 51
52 print "done" 52 print "done"
53
54 def testfixws(a, b, allws):
55 c = bdiff.fixws(a, allws)
56 if c != b:
57 print "*** fixws", repr(a), repr(b), allws
58 print "got:"
59 print repr(c)
60
61 testfixws(" \ta\r b\t\n", "ab\n", 1)
62 testfixws(" \ta\r b\t\n", " a b\n", 0)
63 testfixws("", "", 1)
64 testfixws("", "", 0)
65
66 print "done"