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

Re: git status: small difference between stating whole repository and small subdirectory

From
Jeff King <peff@peff.net>
Date
Feb 16, 2012, 19:20 UTC
Message-ID
<20120216192001.GB4348@sigill.intra.peff.net>
In-Reply-To
<CAA01Cso5y23UMguEe0vwOc6kR3-DjuC8-LTMDsMeeOKU4rVGvg@mail.gmail.com>
On Thu, Feb 16, 2012 at 02:37:47PM +0100, Piotr Krukowiecki wrote:
Show 13 quoted lines
> >> $ time git status  -- .
> >> real    0m2.503s
> >> user    0m0.160s
> >> sys     0m0.096s
> >>
> >> $ time git status
> >> real    0m9.663s
> >> user    0m0.232s
> >> sys     0m0.556s
> >
> > Did you drop caches here, too?
> 
> Yes I did - with cache the status takes something like 0.1-0.3s on whole repo.

OK, then that makes sense. It's pretty much just I/O on the filesystem and on the object db.

You can break status down a little more to see which is which. Try "git update-index --refresh" to see just how expensive the lstat and index handling is.

And then try "git diff-index HEAD" for an idea of how expensive it is to just read the objects and compare to the index.

Show 6 quoted lines
> > Not really. You're showing an I/O problem, and repacking is git's way of
> > reducing I/O.
> 
> So if I understand correctly, the reason is because git must compare
> workspace files with packed objects - and the problem is
> reading/seeking/searching in the packs?

Mostly reading (we keep a sorted index and access the packfiles via mmap, so we only touch the pages we need). But you're also paying to lstat() the directory tree, too. And you're paying to load (probably) the whole index into memory, although it's relatively compact compared to the actual file data.

> Is there a way to make packs better? I think most operations are on
> workdir files - so maybe it'd be possible to tell gc/repack/whatever
> to optimize access to files which I currently have in workdir?

It already does optimize for that case. If you can make it even better, I'm sure people would be happy to see the numbers.

Mostly I think it is just the case that disk I/O is slow, and the operation you're asking for has to do a certain amount of it. What kind of disk/filesystem are you pulling off of?

It's not a fuse filesystem by any chance, is it? I have a repo on an encfs-mounted filesystem, and the lstat times are absolutely horrific.

-Peff
Previous: Piotr KrukowieckiNext: Piotr Krukowiecki
Message 17 of 52 in “git status: small difference between stating whole repository and small subdirectory”
  1. Piotr KrukowieckiFeb 10, 2012
  2. Nguyen Thai Ngoc DuyFeb 10, 2012
  3. Piotr KrukowieckiFeb 10, 2012
  4. Nguyen Thai Ngoc DuyFeb 10, 2012
  5. Piotr KrukowieckiFeb 13, 2012
  6. Piotr KrukowieckiFeb 10, 2012
  7. Thomas RastFeb 14, 2012
  8. Piotr KrukowieckiFeb 15, 2012
  9. Nguyen Thai Ngoc DuyFeb 15, 2012
  10. Piotr KrukowieckiFeb 15, 2012
  11. Piotr KrukowieckiFeb 16, 2012
  12. Jeff KingFeb 15, 2012
  13. Piotr KrukowieckiFeb 16, 2012
  14. Thomas RastFeb 16, 2012
  15. Junio C HamanoFeb 16, 2012
  16. Piotr KrukowieckiFeb 17, 2012
  17. Jeff KingFeb 16, 2012
  18. Piotr KrukowieckiFeb 17, 2012
  19. Jeff KingFeb 17, 2012
  20. Junio C HamanoFeb 17, 2012
  21. Jeff KingFeb 17, 2012
  22. Piotr KrukowieckiFeb 20, 2012
  23. Jeff KingFeb 20, 2012
  24. Thomas RastFeb 20, 2012
  25. Nguyen Thai Ngoc DuyFeb 20, 2012
  26. Jeff KingFeb 20, 2012
  27. Jeff KingFeb 20, 2012
  28. Thomas RastFeb 20, 2012
  29. Jeff KingFeb 20, 2012
  30. Junio C HamanoFeb 20, 2012
  31. Jeff KingFeb 20, 2012
  32. Junio C HamanoFeb 20, 2012
  33. Piotr KrukowieckiFeb 21, 2012
  34. Junio C HamanoFeb 20, 2012
  35. Jeff KingFeb 20, 2012
  36. Nguyen Thai Ngoc DuyFeb 21, 2012
  37. Junio C HamanoFeb 21, 2012
  38. Nguyen Thai Ngoc DuyFeb 22, 2012
  39. Junio C HamanoFeb 22, 2012
  40. Nguyen Thai Ngoc DuyFeb 22, 2012
  41. Thomas RastFeb 22, 2012
  42. Nguyen Thai Ngoc DuyFeb 22, 2012
  43. Junio C HamanoFeb 22, 2012
  44. Piotr KrukowieckiApr 10, 2012
  45. Junio C HamanoApr 10, 2012
  46. Jeff KingApr 10, 2012
  47. Junio C HamanoFeb 20, 2012
  48. Thomas RastFeb 20, 2012
  49. Nguyen Thai Ngoc DuyFeb 20, 2012
  50. Jeff KingFeb 20, 2012
  51. Junio C HamanoFeb 20, 2012
  52. Jeff KingFeb 20, 2012

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.