__git_ps1在内核树极其缓慢 [英] __git_ps1 extremely slow in kernel tree

查看:82
本文介绍了__git_ps1在内核树极其缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ time __git_ps1
((v2.6.33.4))
real    0m1.467s
user    0m0.864s
sys  0m0.564s

它让我提示无法使用;在另一方面,虽然,这是太有用了一个轻言放弃的功能。为什么它运行这么慢,什么我可以做什么呢?任何想法

It's making my prompt unusable; on the other hand, though, it's too useful a feature to give up lightly. Any idea why it runs so slow and what I can do about it?

安装的细节:

$ uname -a
Linux martin-laptop 2.6.35-22-generic #35-Ubuntu SMP Sat Oct 16 20:36:48 UTC 2010 i686 GNU/Linux

$ git --version
git version 1.7.1

$ du -sh .
876M    .

我怀疑我的机器的东西,因为在我的同事的盒子,在内核树我是从,同样的命令返回即时

I suspect something with my machine since on my coworker's box, in the kernel tree I cloned from, the same command returns instantly

$ time __git_ps1
((v2.6.33.4))
real    0m0.039s
user    0m0.008s
sys 0m0.016s


添加hdparm的输出:


adding hdparm output:

我的

$ sudo hdparm -tT /dev/sda4

/dev/sda4:
 Timing cached reads:   1542 MB in  2.00 seconds = 772.35 MB/sec
 Timing buffered disk reads:  110 MB in  3.02 seconds =  36.42 MB/sec

同事的

$ sudo hdparm -Tt /dev/sda6

/dev/sda6:
 Timing cached reads:   1850 MB in  2.00 seconds = 926.03 MB/sec
 Timing buffered disk reads:  210 MB in  3.02 seconds =  69.53 MB/sec


其他方面的差异:同事运行git的1.6.5,我跑1.7.1


other differences: coworker is running git 1.6.5, i'm running 1.7.1

推荐答案

原来是两件事情的组合:

It turned out to be a combination of two things:

我用

export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true

在默认情况下。这被证明是在树上内核的大小无法使用。删除这些选项去掉一点从__git_ps1不错的功能,但至少现在立即返回。 (有益的教训 - 从任何其他事情之前刚创建的用户帐户尝试的东西)

by default. which proved to be unusable on a tree the size of the kernel. Removing these options removes a bit of nice functionality from __git_ps1, but at least it returns instantly now. (Useful lesson - try out stuff from a freshly created user account before anything else.)

另外,我的工作机器上的硬盘只是普通的慢,所以这不是一个Git本身的问题;这只是第一次真的obtruded本身在我的注意。

Also, the hard disk on my work machine is just plain slow, so that wasn't a git problem per se; it's just the first time it really obtruded itself upon my notice.

这篇关于__git_ps1在内核树极其缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆