Re: Silly Question About Timing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9 February 2012 13:16, Seth Robertson <in-gitvger@xxxxxxxx> wrote:
>
> In message <CAE1pOi1+FQNoPZ_P-fmFx-YhnUYzMQT=6zh3s-OyT71vcDm=wQ@xxxxxxxxxxxxxx>, Hilco Wijbenga writes:
>
>    I've noticed that entering a Git controlled project directory takes
>    quite some time so I wanted to measure exactly how much (it's the
>    prompt I'm using that's taking the time, I suspect). I first tried (a
>    bit naive, I admit :-) )
>
>    time cd my-project
>
> Your confusion is because you are measuring the wrong thing.  I'm
> assuming, here, that you have a shell prompt which is giving you all
> sorts of status about the git repository.  The "cd" operation is
> instantaneous, it is the shell attempting to compute the new prompt
> which is slow.

Yes, exactly.

> Exactly how your shell does this is shell dependent, but you might
> want to look at your setting of $PROMPT_COMMAND.  Then you can test it
> by running something like:
>
> time sh -c "cd git-directory; $PROMPT_COMMAND"

I tried that and it's still instantaneous.

The culprit is

export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \W$(__git_ps1 "
(%s)")\$\[\033[00m\] '

but I can't get that to run. Simply running

echo $PS1

doesn't work and I have been unable to get the __git_ps1 part to do anything.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]