* why FOO=(${(s/./)ARR[3]}) so slowly?
@ 2016-10-28 18:36 cuodao
0 siblings, 0 replies; only message in thread
From: cuodao @ 2016-10-28 18:36 UTC (permalink / raw)
To: zsh-workers, gcw
[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]
when i first start my iterm2 (zsh with oh-my-zsh),it's very slow.
After trace, I found function git_compare_version caused, exactly by this line:
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
here are a simulate
$ cat zsh-test.sh
#!/usr/bin/env zsh -xv
export PS4=$'%D{%M%S%.} %N:%i> '
INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null));
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
echo "$INSTALLED_GIT_VERSION"
#!/usr/bin/env zsh -xv
export PS4=$'%D{%M%S%.} %N:%i> '
+./zsh-test.sh:2> export PS4='%D{%M%S%.} %N:%i> '
INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null));
5649865 ./zsh-test.sh:4> INSTALLED_GIT_VERSION=5649867 ./zsh-test.sh:4> git --version
5649865 ./zsh-test.sh:4> INSTALLED_GIT_VERSION=( git version 2.8.4 '(Apple' 'Git-73)' )
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
5650999 ./zsh-test.sh:5> INSTALLED_GIT_VERSION=( 2 8 4 )
echo "$INSTALLED_GIT_VERSION"
5650999 ./zsh-test.sh:7> echo '2 8 4'
2 8 4
It's elapsed more than 1 seconds, but when I run it again, it's just elapsed tens of milliseconds
It's just slowly at first run (reboot os).
why ?
my zsh version: zsh 5.2 (x86_64-apple-darwin16.0.0)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-10-28 18:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-28 18:36 why FOO=(${(s/./)ARR[3]}) so slowly? cuodao
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).