libgit2 / pygit2

Python bindings for libgit2
https://www.pygit2.org/
Other
1.58k stars 382 forks source link

remote fetch is extremely slow #1146

Open wmtorode opened 2 years ago

wmtorode commented 2 years ago

I have a tool that pulls down and installs a decent sized repository. Cloning the repo is fast and works well, however fetching subsequent updates is extremely slow. trying to figure out where the slowdown was coming from I ran my code through a profiler and obtained this result:

ncalls tottime percall cumtime percall filename:lineno(function) 1 0.001 0.001 616.895 616.895 \bkprocessor.py:1645(_startCacheUpdate) 1 0.000 0.000 405.243 405.243 AppData\Roaming\Python\Python37\site-packages\pygit2\remote.py:120(fetch) 1 404.655 404.655 405.243 405.243 {built-in method pygit2._libgit2.git_remote_fetch} 1 0.000 0.000 210.191 210.191 AppData\Roaming\Python\Python37\site-packages\pygit2__init__.py:165(clone_repository) 1 204.704 204.704 210.191 210.191 {built-in method pygit2._libgit2.git_clone}

as you can see it cloned the repo in 210 seconds, pulling down nearly 1300 MB. during the clone additional commits came in and the subsequent fetch pulled down 42 MB quickly but then seemed to sit taking a total of 405 seconds, nearly twice as long as the clone operation.

Now I'm not sure exactly what in the fetch is taking so long, but whatever it is happens after retrieval of the data from the remote.

any advice on what I can do?