Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

plumbing/object: avoid O(N^2) string building when decoding commit me… #1246

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

dsymonds
Copy link
Contributor

…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 Author

dsymonds commented Dec 1, 2019

Hey, any chance this'll get merged soon, @mcuadros @smola ?

…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>
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants