On Sat, Oct 09, 2021 at 06:05:56PM +0000, 程洋 wrote: > I have a really big repository which has 9m objects and maybe 300k refs. > I noticed that git push is really slow for a tiny change. An example shows below > > 3 objects which is only 7 kb takes 36 seconds to pack-objects (it's the time after i enable pack.usesparse) > However if I manually call “pack-objects” with the exactly same objects SHA1. It only take less than 0.005 second > What is really pass to “pack-objects” when I call “git push”? Do you have an objects/pack/pack-*.bitmap file on the sending side? The bitmap code is eager to produce an exact set difference between what is being sent and what the other side has. If you have incomplete bitmap coverage (which is almost a certainty if you have 300k refs), it may do a lot of traversal filling in the "what the other side has" part of the bitmap, even though it does not end up helping the final result in this case. Bitmaps are enabled by default on bare repos since Git v2.22.0. You can override this with: git config repack.writeBitmaps false git gc (or if you don't want to do the gc, you can safely remove the '.bitmap' file). I notice you used GIT_TRACE_PERFORMANCE below. Try GIT_TRACE2_PERF instead, which goes into detail within particular processes. If this is related to bitmaps, I'd expect the time to go to the "enumerate-objects" region. -Peff