git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomas Carnecky <tomas.carnecky@gmail.com>
To: Jeff King <peff@peff.net>, git@vger.kernel.org
Cc: "Carlos Martín Nieto" <cmn@elego.de>,
	"Jay Soffian" <jaysoffian@gmail.com>
Subject: Re: top-level gitignore considered harmful
Date: Fri, 30 Mar 2012 09:30:27 +0000	[thread overview]
Message-ID: <1333099827-ner-1054@calvin> (raw)
In-Reply-To: <20120329211136.GA1112@sigill.intra.peff.net>

On Thu, 29 Mar 2012 17:11:36 -0400, Jeff King <peff@peff.net> wrote:
> So we were sitting around chatting today about how slow "git status" is
> in the gigantic WebKit repository (because really, what else would one
> chat about?). Carlos noticed that git spends a lot of time in the
> gitignore code path.  It turns out that the WebKit repository has a
> couple hundred excludes in the top-level .gitignore, many of which are
> for specific files deep in the repository.
> 
> Since these patterns are compared via fnmatch(), we have to process them
> linearly for each entry[1]. And since the patterns are at the top level,
> we check them for each of the ~180,000 files in the repository. So "git
> status" will do O(m*n) work, where "m" is the number of patterns and "n"
> is the number of files in the repository. And as a project grows over
> time, one might expect "m" to be some constant factor of "n". So this is
> really O(n^2) (albeit with some mitigating constant at the front).

Many months ago I noticed that as well, when somebody came to #git and
complained that git status is slow (it toook *many* seconds for him). We
tracked that down to the fact that his .gitignore contained hundreds of
entries. He basically did `git ls-files --other >> .gitignore`, so his
.gitignore included every single object file and all other build artefacts.
I told him to use wildcards and `git status` became usable again.

tom

      parent reply	other threads:[~2012-03-30  9:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-29 21:11 top-level gitignore considered harmful Jeff King
2012-03-29 22:06 ` Junio C Hamano
2012-03-30  9:30 ` Tomas Carnecky [this message]

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=1333099827-ner-1054@calvin \
    --to=tomas.carnecky@gmail.com \
    --cc=cmn@elego.de \
    --cc=git@vger.kernel.org \
    --cc=jaysoffian@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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.
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 NNTP newsgroup(s).