mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <>
To: "Uwe Kleine-König" <>
Cc: "SZEDER Gábor" <>,
	"Philipp Zabel" <>,,
Subject: Re: git slow unless piped to cat
Date: Tue, 27 Aug 2019 14:59:30 -0400	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Tue, Aug 27, 2019 at 12:04:27PM +0200, Uwe Kleine-König wrote:

> 	$ sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"; time env GIT_CONFIG_NOSYSTEM=1 HOME=/nonexistant XDG_CONFIG_HOME=/nonexistant git --no-pager show --no-color --no-decorate v5.2
> 	...
> 	real	0m1.041s
> 	user	0m0.000s
> 	sys	0m0.021s
> 	$ git for-each-ref |wc -l
> 	10013
> So this is indeed the problem.

That's not that many refs. Are they mostly unpacked? Loose refs are
awful on a cold cache, since it's one inode per ref (or worse, since it
has walk the directories, too).


  find .git/refs -type f | wc -l

to see the loose ones. If there are a lot, try:

  git pack-refs --prune --all

(or just "git gc", which does this).

Modern versions of Git should delete any leftover empty directories
after pruning the loose variants, but I think won't go out of their way
to remove ones they didn't delete from. And those are still expensive to
walk on a cold cache. If it's still slow, try:

  find .git/refs/* -type d | xargs rmdir -v


  parent reply	other threads:[~2019-08-27 18:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27  8:15 git slow unless piped to cat Uwe Kleine-König
2019-08-27  8:41 ` SZEDER Gábor
2019-08-27  8:56   ` Uwe Kleine-König
2019-08-27  9:12     ` Philipp Zabel
2019-08-27  9:44       ` SZEDER Gábor
2019-08-27 10:04         ` Uwe Kleine-König
2019-08-27 10:33           ` SZEDER Gábor
2019-08-27 10:56             ` Uwe Kleine-König
2019-08-27 11:28               ` Michal Suchánek
2019-08-27 18:59           ` Jeff King [this message]
2019-08-27 21:32             ` Uwe Kleine-König
2019-08-27 21:38               ` Bryan Turner
2019-08-28 10:24                 ` Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).