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

Re: [PATCH] git-completion.bash - avoid excruciatingly slow ref completion on Cygwin

From
Tay Ray Chuan <rctay89@gmail.com>
Date
Oct 18, 2014, 14:47 UTC
Message-ID
<CALUzUxpGXwu=sdh7MHjEcJzDRzZZkTR0NajU0hrBGCZZLGj2aw@mail.gmail.com>
In-Reply-To
<1413042673-24052-1-git-send-email-mlevedahl@gmail.com>
On Sat, Oct 11, 2014 at 11:51 PM, Mark Levedahl <mlevedahl@gmail.com> wrote:
Show 9 quoted lines
>
> $git checkout <tab> was taking about 3.5 seconds to respond on one
> repository having four remotes with about 100 total refs (measured on
> Cygwin).  All of the time was being claimed in "git for-each-ref" to do
> its work.  This working directory was created using git-new-workdir, and
> thus .git/refs and .git/packed-refs are both symlinks.  for-each-ref
> operates in a way that causes the .git/refs symlink to be resolved
> multiple times for each ref in the repository, and Cygwin is especially
> slow in such operations.
Thanks for looking into this.
> Patching refs.c to avoid repeatedly dereferencing the symlink reduced
> execution time from about 3.5 seconds to about 1.1 seconds (but no
> improvement on Linux),

This makes your patch sound bad, but it isn't when one realises it is already fast on Linux!

> [snip]
>
> Relevant timing results using the same repository on both Linux and
> Cygwin:
FWIW, timings on msysgit:
$ time git for-each-ref --format="%(refname:short)" refs

real 0m8.799s user 0m0.109s sys 0m0.250s

$ time (cd "$GIT_DIR" ; cat packed-refs ; find refs/ -type f) \
        2>/dev/null | sed -ne 's@^.*refs/@refs/@p' | sort | uniq

real 0m3.406s user 0m1.073s sys 0m2.398s

so while your symlink-analysis might not accurately describe msysgit (I believe copies are made in place of a symlink), msysgit benefits from this too.

-- 
Cheers,
Ray Chuan

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "Git for Windows" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Previous: Mark Levedahl
Message 2 of 2 in “git-completion.bash - avoid excruciatingly slow ref completion on Cygwin”
  1. git-completion.bash - avoid excruciatingly slow ref completion on CygwinMark Levedahl, Oct 11, 2014
  2. Tay Ray ChuanOct 18, 2014

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.