Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plumbing/object: avoid O(N^2) string building when decoding commit message #4

Closed
wants to merge 1 commit into from

Conversation

mcuadros
Copy link
Member

@mcuadros mcuadros commented Mar 9, 2020

Original created by @dsymonds at src-d/go-git#1246

Most commits have relatively small messages, so this was never
noticeable. However, there are some repositories that have
semi-automated messages that can get very large (e.g.
github.com/riscv/riscv-clang and its riscv-trunk branch), on the order
of 109k lines. Changing from string += to using a bytes.Buffer reduces
the time for Commit.Decode for that specific case from 35s to 74ms.

Signed-off-by: David Symonds <dsymonds@golang.org>

…ssage

Most commits have relatively small messages, so this was never
noticeable. However, there are some repositories that have
semi-automated messages that can get very large (e.g.
github.com/riscv/riscv-clang and its riscv-trunk branch), on the order
of 109k lines. Changing from string += to using a bytes.Buffer reduces
the time for Commit.Decode for that specific case from 35s to 74ms.

Signed-off-by: David Symonds <dsymonds@golang.org>
@dsymonds
Copy link
Contributor

dsymonds commented Mar 9, 2020

Oh, there's a new repo? Did you want me to make a new PR against this one?

@mcuadros
Copy link
Member Author

mcuadros commented Mar 9, 2020

Yes, the previous repository is completely blocked you can read about it at comment. Source{d} is in bankrupts but I co-founded a new company that is willing to maintain this repository but to avoid the current problem in the future we are setting the project in an independent organization.

Fill free to create a new PR (if you make it fast), since I am going to merge the PRs and then change the import path and bump a new version based on go modules.

@dsymonds
Copy link
Contributor

dsymonds commented Mar 9, 2020

Okay, check out #7 instead of this.

@mcuadros mcuadros closed this Mar 9, 2020
@mcuadros mcuadros deleted the pr-1246 branch March 10, 2020 00:47
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.

None yet

2 participants