[英]Git bash trace - Why so slow?
I am using git bash on Windows 7 which is extremely slow.我在 Windows 7 上使用 git bash,速度非常慢。 The user profile is on a network drive, so I changed the start to start on the c: drive.用户配置文件在网络驱动器上,所以我将启动更改为在 c: 驱动器上启动。 I also removed the PS1 prompt and I just use $
.我还删除了 PS1 提示,我只使用$
。
I also have done:我也做过:
$ git config --global core.preloadindex true
$ git config --global core.fscache true
Some things have speed up, but the git commands themselves are extremely slow.有些事情已经加快了,但是 git 命令本身却非常慢。 Any idea why?知道为什么吗? Here is a strace.这是一条线索。
$ GIT_TRACE=1 git stash
09:27:27.099458 git.c:594 trace: exec: 'git-stash'
09:27:27.099458 run-command.c:369 trace: run_command: 'git-stash'
09:27:28.862258 git.c:594 trace: exec: 'git-sh-i18n--envsubst' '--variables' 'usage: $dashless $USAGE'
09:27:28.862258 run-command.c:369 trace: run_command: 'git-sh-i18n--envsubst' '--variables' 'usage: $dashless $USAGE'
09:27:29.096258 git.c:594 trace: exec: 'git-sh-i18n--envsubst' 'usage: $dashless $USAGE'
09:27:29.096258 run-command.c:369 trace: run_command: 'git-sh-i18n--envsubst' 'usage: $dashless $USAGE'
09:27:29.877258 git.c:369 trace: built-in: git 'rev-parse' '--git-dir'
09:27:30.267258 git.c:369 trace: built-in: git 'rev-parse' '--git-path' 'objects'
09:27:30.766458 git.c:369 trace: built-in: git 'rev-parse' '--show-toplevel'
09:27:30.984858 git.c:369 trace: built-in: git 'rev-parse' '--git-path' 'index'
09:27:31.281258 git.c:369 trace: built-in: git 'config' '--get-colorbool' 'color.interactive'
09:27:31.608858 git.c:369 trace: built-in: git 'config' '--get-color' 'color.interactive.help' 'red bold'
09:27:31.967658 git.c:369 trace: built-in: git 'config' '--get-color' '' 'reset'
09:27:32.375258 git.c:369 trace: built-in: git 'ls-files' '--error-unmatch' '--'
09:27:32.702858 git.c:369 trace: built-in: git 'update-index' '-q' '--refresh'
09:27:33.048058 git.c:369 trace: built-in: git 'diff-index' '--quiet' '--cached' 'HEAD' '--ignore-submodules' '--'
09:27:33.392258 git.c:369 trace: built-in: git 'diff-files' '--quiet' '--ignore-submodules' '--'
No local changes to save
On Cygwin, real time is only 3 seconds.在 Cygwin 上,实时只有 3 秒。 Here on git bash, 9 seconds.在 git bash 上,9 秒。
$ time git stash
No local changes to save
real 0m9.172s
user 0m0.015s
sys 0m0.108s
$
Here is Cygwins trace to compare against:这是要与之比较的 Cygwins 跟踪:
$ GIT_TRACE=1 git stash
13:02:51.567376 git.c:595 trace: exec: 'git-stash'
13:02:51.567376 run-command.c:369 trace: run_command: 'git-stash'
13:02:52.740271 git.c:595 trace: exec: 'git-sh-i18n--envsubst' '--variables' 'usage: $dashless $USAGE'
13:02:52.740271 run-command.c:369 trace: run_command: 'git-sh-i18n--envsubst' '--variables' 'usage: $dashless $USAGE'
13:02:52.990489 git.c:595 trace: exec: 'git-sh-i18n--envsubst' 'usage: $dashless $USAGE'
13:02:52.990489 run-command.c:369 trace: run_command: 'git-sh-i18n--envsubst' 'usage: $dashless $USAGE'
13:02:53.459647 git.c:371 trace: built-in: git 'rev-parse' '--git-dir'
13:02:53.694226 git.c:371 trace: built-in: git 'rev-parse' '--git-path' 'objects'
13:02:53.975720 git.c:371 trace: built-in: git 'rev-parse' '--show-toplevel'
13:02:54.085191 git.c:371 trace: built-in: git 'rev-parse' '--git-path' 'index'
13:02:54.194661 git.c:371 trace: built-in: git 'config' '--get-colorbool' 'color.interactive'
13:02:54.304131 git.c:371 trace: built-in: git 'config' '--get-color' 'color.interactive.help' 'red bold'
13:02:54.413601 git.c:371 trace: built-in: git 'config' '--get-color' '' 'reset'
13:02:54.523071 git.c:371 trace: built-in: git 'update-index' '-q' '--refresh'
13:02:54.775294 git.c:371 trace: built-in: git 'diff-index' '--quiet' '--cached' 'HEAD' '--ignore-submodules' '--'
13:02:54.900403 git.c:371 trace: built-in: git 'diff-files' '--quiet' '--ignore-submodules'
No local changes to save
First, regarding strace, you now have a new option with Git 2.27 (Q2 2020)首先,关于 strace,您现在有了 Git 2.27(2020 年第二季度)的新选项
See commit 3efc128 (09 Apr 2020), and commit b6852e1 (08 Apr 2020) by Johannes Schindelin ( dscho
) .请参阅提交 3efc128 (2020 年 4 月 9 日)和Johannes Schindelin ( dscho
) 提交的 b6852e1 (2020 年 4 月 8 日)。
See commit a748f3f (08 Apr 2020) by Matthias Aßhauer ( rimrul
) .请参阅Matthias Aßhauer ( rimrul
)的提交 a748f3f (2020 年 4 月 8 日)。
(Merged by Junio C Hamano -- gitster
-- in commit b3eb70e , 22 Apr 2020) (由Junio C Hamano 合并gitster
提交 b3eb70e ,2020 年 4 月 22 日)
mingw
: help debugging by optionally executing bash with stracemingw
:通过可选地使用 strace 执行 bash 来帮助调试Signed-off-by: Johannes Schindelin签字人:Johannes Schindelin
MSYS2's strace facility is very useful for debugging... With this patch, the bash will be executed through
strace
if the environment variableGIT_STRACE_COMMANDS
is set, which comes in real handy when investigating issues in the test suite. MSYS2 的 strace 工具对于调试非常有用...有了这个补丁,如果设置了环境变量GIT_STRACE_COMMANDS
,bash 将通过strace
执行,这在调查测试套件中的问题时非常方便。Also support passing a path to a log file via
GIT_STRACE_COMMANDS
to force Git to callstrace.exe
with the-o <path>
argument, ie to log into a file rather than print the log directly.还支持通过GIT_STRACE_COMMANDS
将路径传递到日志文件,以强制 Git 使用-o <path>
参数调用strace.exe
,即登录到文件而不是直接打印日志。That comes in handy when the output would otherwise misinterpreted by a calling process as part of Git's output.当输出会被调用进程误解为 Git 输出的一部分时,这会派上用场。
Note: the values "
1
", "yes
" or "true
" are not specifying paths, but tell Git to let strace.exe log directly to the console.注意:值“1
”、“yes
”或“true
”不是指定路径,而是告诉 Git 让 strace.exe 直接登录到控制台。
Second, don't forget recent Git version (2.22+) the trace2
utility其次,不要忘记最近的 Git 版本 (2.22+) trace2
实用程序
In your case, set GIT_TRACE2_PERFORMANCE=1&& git <command>
would help see where the performance issue occurs在您的情况下, set GIT_TRACE2_PERFORMANCE=1&& git <command>
将有助于查看性能问题发生的位置
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.