This is an archive of the discontinued Mercurial Phabricator instance.

mdiff: explicitly compute places for the newline marker
ClosedPublic

Authored by joerg.sonnenberger on Jan 25 2018, 8:35 PM.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

I don't completely trust my numbers here, but it seems to give at least 3-4% for diffing netbsd-7 and netbsd-8.

3-4% is in line with what I'm seeing with ./hg perfunidiff mercurial/manifest.py 0 --count 500 --profile, and this looks like a better fix than what I've got. I'm a little weirded out by the change in interface where _unidiff yields a bool and then a sequence of hunks - was that needed for the change to work? I'm having trouble telling.

No, the change to yield a bool first is not strictly necessary for the rest of the logic. But it cheaply kills the need for the rewindhunk generator, i.e. it cuts a layer of indirection cheaply.

I'd slightly prefer this as two patches: one that does away with the rewindhunks goo (yay!), and then one that does the book-keeping to intelligently emit the "no newline" business. Can you tackle that?

This revision was automatically updated to reflect the committed changes.