Skip to content

Conversation

@csnover
Copy link
Contributor

Popen in many versions of Python (possibly all versions prior to 3.3.1?) defaults to using unbuffered reads (bufsize=0), which are extremely slow. When reading a 160k-line file from git, unbuffered reads take 5.75s; buffered reads take 0.23s.

Newer versions of Python 3 appear to change the default to bufsize=-1 so this may only be a problem for a subset of users, but it certainly was a problem for me. I’m not sure of any reason not to just use buffered reads by default for everyone, so I am submitting this patch for evaluation. Thanks!

Popen defaults to using unbuffered reads, which are extremely slow.
@Byron
Copy link
Member

Thanks for bringing this up ! Even though I might have had the hunch that parsing git command output is a bit slow, it never struck me as being due to disabled buffering - apparently I wanted to believe it's just due to python.
Thus I am happily merging this awesome fix.

@ByronByron added this to the v1.0.3 - Fixes milestone Feb 25, 2016
Byron added a commit that referenced this pull request Feb 25, 2016
@ByronByron merged commit 0f4d5ce into gitpython-developers:masterFeb 25, 2016
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@csnover@Byron