git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] refs.c: get_ref_cache: use a bucket hash

From
Andreas Krey <a.krey@gmx.de>
Date
Mar 16, 2015, 18:40 UTC
Message-ID
<20150316184040.GA8902@inner.h.apk.li>
In-Reply-To
<xmqq1tkosvpi.fsf@gitster.dls.corp.google.com>
On Mon, 16 Mar 2015 10:23:05 +0000, Junio C Hamano wrote:
> Andreas Krey <a.krey@gmx.de> writes:
> 
...
> say "a lot of ignored directories", but do you mean directories in
> the working tree (which I suppose do not have much to do with the
> submodule_ref_caches[])?
Apparently, they do.
>I am guessing that the repository has tons
> of submodules?

Not a single one. Thats's thie interesting thing that makes me think I'm not actually solving the right problem.

This repo has about 100k subdirectories that are ignored (I don't know whether directly or within ignored dirs), and strace said that git looks for '.git/HEAD' and one other file in each of these. Apparently it trieds to find out if any of these dirs happen to be a git repo which git clean treats specially, but it seems it also calls get_ref_cache for each of these dires even though the turn out not to be a sub-repo.

In other words: I suspect that get_ref_cache shouldn't be called that often, or that the cache entries should be removed once a directory is found not to be a sub repo. Then the linear list wouldn't really hurt.

I'll look into that tomorrow, and also into the hashmap API.
Andreas
-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800
Previous: Junio C HamanoNext: Jeff King
Message 4 of 12 in “refs.c: get_ref_cache: use a bucket hash”
  1. refs.c: get_ref_cache: use a bucket hashAndreas Krey, Mar 16, 2015
  2. Thomas GummererMar 16, 2015
  3. Junio C HamanoMar 16, 2015
  4. Andreas KreyMar 16, 2015
  5. Jeff KingMar 17, 2015
  6. Junio C HamanoMar 17, 2015
  7. Jeff KingMar 17, 2015
  8. Andreas KreyNov 13, 2015
  9. Jeff KingNov 14, 2015
  10. Andreas KreyNov 14, 2015
  11. Andreas KreyNov 14, 2015
  12. Jeff KingNov 16, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.