implement a far far faster diff parser · gitpython-developers/GitPython@753e908 · GitHub
Skip to content

Commit 753e908

Browse files
Paul Sowdenempty
authored andcommitted
implement a far far faster diff parser
The old diff parser in list_from_string took a large amount of time to parse long diffs, on one of my repositories it took over 3 minutes to parse the initial commit. The new parser uses a single regexp to match the header of a diff, and iterates over the each individual diff by splitting the entire string by the diff seperator, attempting to match the header for each individual diff. With the new parser parsing the same repository is almost instant, woohoo! (cherry picked from commit 5b6b27f153bdc30380bea12a528ef483571dd57a)
1 parent 9e14356 commit 753e908

2 files changed

Lines changed: 20 additions & 43 deletions

File tree

lib/git/diff.py

Lines changed: 19 additions & 42 deletions

test/git/test_commit.py

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)