Skip to content

Add an option to parse only hunk positions#68

Merged
matiasb merged 1 commit intomatiasb:masterfrom
p12tic:only-hunk-positions
Apr 22, 2020
Merged

Add an option to parse only hunk positions#68
matiasb merged 1 commit intomatiasb:masterfrom
p12tic:only-hunk-positions

Conversation

@p12tic
Copy link
Copy Markdown
Contributor

@p12tic p12tic commented Apr 4, 2020

In my use case I'm using this great library to figure out how code has moved around. For this use case the only thing that matters is the hunk positions and sizes. Unfortunately full diff parsing uses large amount of memory and is slow and there's no way to disable it in this library.

This PR adds a new option only_hunk_positions that enables a fast code path that only parses the hunk headers, only does minimal parsing of the line contents and does not store them. Enabling this option results in ~20 times less memory use and 6 times faster diff parsing on Python 3.6 (2.5 times on Python 2.7).

@matiasb
Copy link
Copy Markdown
Owner

matiasb commented Apr 7, 2020

Looks good! Just pushed an updated PR (#70) solving the conflict and with some refactoring, besides renaming the param as metadata_only instead. Let me know if that makes sense to you?
Thanks 👍

@matiasb matiasb merged commit 3d99a41 into matiasb:master Apr 22, 2020
@p12tic p12tic deleted the only-hunk-positions branch August 8, 2020 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants