Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: sluggish prompt



On Sun 10/07/07 at 10:02 AM -0700,
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:

> [...]  Have you looked at the output of "ps" [...]
> to see how much memory your shell is consuming?

[panix1:~]  [v4.3.4]  zsh  1003 --> ps up$$
USER   PID %CPU %MEM VSZ  RSS TTY   STAT STARTED    TIME COMMAND
rj   18666  0.1  0.2 800 2608 ttyr0 Ss    6:25PM 0:00.81 zsh-4.3.4

Is "0.2" percent of memory usage normal?  Not sure how to guage that.


> Are you having this problem on a personal workstation, when logging in
> to a shared server, or in some other situation?  How busy is the system
> in general?

None of this is on my machine (I'm running an old Mac G3).  I (always)
bring up zsh by SSH-ing into my ISP, Panix.com (one of the best around).
I log into one of 4 or 5 user hosts.  I don't think there's anything
about the busyness of panix that would cause the promt-delay.


> It's not clear from your series of messages whether this happened only
> when you started the shell, or every time there was a prompt.

It's almost every time.  Of course, if I'm at the prompt and I hit <RETURN>
several times, there's no delay.  If I haven't been to that window, that
shell, for awhile, and the prompt has been there, and I go back to that
window after awhile and hit <RETURN>, there's a delay.


> If only at startup, then it's not something to worry about.

It's definitely not just at startup.


> I believe you could replace that entire loop with
> 	autoload ${^fpath}/*(N-.:t)

Replaced.


> There's nothing alarming in there.  Leave the "set -x" out of your rc
> file and instead edit your precmd to be:
> 
>     function precmd {
> 	local exitstatus=$?
> 	print -u2 PRECMD
> 	psvar[1]=SIG
> 	[[ $exitstatus -ge 128 ]] && psvar[1]=SIG$signals[$exitstatus-127]
> 	psvar[2]=$#jobstates; [[ $psvar[2] -eq 0 ]] && psvar[2]=()
>     }
> 
> Now watch carefully.  When you get the 6-10 second delay, does it happen
> before or after the word PRECMD is printed?


I put the print line in .zshrc, closed vim.  Back at the prompt I did

	exec zsh -l

Then I waited 8 seconds.  Then the "PRECMD" appeared, and the prompt
immediately appeared on the next line.


> Do you have anything in other init files such as .zlogin, .zprofile, etc.?

I use 3 startup files.  Here are the other 2.   zprofile first, then the
.zshenv.  Thanks again.

------------------------------------------------------------------------------
#
#               Russell Hoover's panix .zprofile for zsh 4.3.4
#               Last update:  2007/10/07    9:33  p.m.     EDT
#
#   IMPORTANT: Remember that on panix, zsh executes the ~/.zshenv file *before*
#   it executes /etc/zprofile (the system's default zprofile).  That means that
#   any variables set in  ~/.zshenv get *overwritten* by what's set in
#   /etc/zprofile.  Therefore, put any variables that are set in /etc/zprofile
#    -- and which I want re-set -- into ~/.zshrc, to re-set them.
#
#   Order of execution (on panix) of zsh startup files:
#
#   (1)  ~/.zshenv      (2)  /etc/zprofile      (3)  ~/.zprofile      (4)  ~/.zshrc
#
#   Given the above, the following are general
#   guidelines from the "Intro to Zsh" doc:
#
#   ".zprofile is sourced in login shells. It should contain
#     commands that should be executed only in login shells.
#
#   .zprofile is sourced before .zshrc.
#
#   .zprofile is not the place for alias definitions, options, environment
#   variable settings, etc.; as a general rule, it should not change the
#   shell environment at all.  Rather, it should be used to set the terminal
#   type and run a series of external commands (fortune, msgs, etc)."
#

biff n
mesg y
stty rows 44
stty columns 129
export TERM=vt220
exec zsh-4.3.4     # panix still has 4.2.5 as default zsh.
export SHELL=/usr/local/bin/zsh-4.3.4
stty dsusp undef discard ^O

# The "dsusp undef" part above turns off special processing for ^Y, which can be
# helpful sometimes. (When apps want to use it but stay in cooked mode, I think.)

# ------------------
# Getting your terminal to handle ISO characters:  Terminal drivers
# normally do not pass 8-bit characters. To enable proper handling of
# ISO characters, add the following lines to your startup (e.g.
# .profile) file:

tty -s
if [ $? = 0 ]; then
        stty cs8 -istrip -parenb >&0
fi
# ------------------



--------------------------------------------------------------------------------


#
#               Russell Hoover's panix .zshenv file for zsh 4.3.4
#               Last  update:     2007/10/07    9:40  p.m.    EDT
#
#       From "Intro to Zsh":  ".zshenv is sourced on all invocations of
#       the shell . . .  It should contain commands to set the command search
#       path [*** EXCEPT that on panix, $PATH is set in /etc/zprofile, which
#       overwrites .zshenv; thus I've re-set $PATH in .zshrc ***], plus other
#       important environment variables.  .zshenv should not contain commands
#       that produce output or assume the shell is attached to a tty."
#
export  BAUD=115200
export  CDPATH=$HOME:$HOME/Mail:$HOME/News
export  COLORFGBG="yellow;black"
export  COLORTERM=on
export  LS_COLORS=di=32:fi=36:ex=31:no=
export  DIRSTACKSIZE="60 |less"
export  EDITOR=vim
export  FCEDIT=vim
export  FPATH=/usr/local/libdata/zsh/4.3.4/functions/:$HOME/.zfunc
export  HISTFILE=$HOME/.history
#export  LANG="en_US.ISO8859-1"
#export  LC_CTYPE="en_US.ISO8859-1"    # Beware: "en_US.UTF-8" here will ruin man pg display in the "most" pager.
#export  LC_MESSAGES="en_US.ISO8859-1"
export  LESS=-CeiMwq
export  LOGCHECK=10      # Check every ten seconds for login/logout activity.
export  MAILER=mutt_slang

mailpath=( ~/.maildir/**/cur/.(/D:h:h) )
mailpref=$HOME/Mail/

export MOST_INITFILE=$HOME/.lesskeys.rc
export NNTPSERVER=news.panix.com
export ORGANIZATION="PANIX, New York City"
export PAGER=most


export PS1=$'%{\e[1;32m%}[$red%m$white:$cyan%~$green]  [%{\e[m%}%{\e[36m%}v$ZSH_VERSION$green]  %{\e[m%}zsh%(2L./$blue$SHLVL.)$yellow%(2v:$grey/$yellow+%2v:)  $white! $red--$yellow> %{\e[m%}'


export PS2=$'$yellow   %_ %{\e[1;35m%} --> %{\e[m%}'
export RPS1=$'%{\e[1;34m%} %l  $yellow%D{%A  %Y/%m/%d  %T} %{\e[m%}'

# Lets set up the necessary colors to use in prompts and elsewhere:

grey=$'%{\e[1;30m%}'
red=$'%{\e[1;31m%}'
green=$'%{\e[1;32m%}'
yellow=$'%{\e[1;33m%}'
blue=$'%{\e[1;34m%}'
magenta=$'%{\e[1;35m%}'
cyan=$'%{\e[1;36m%}'
white=$'%{\e[1;37m%}'
lored=$'%{\e[0;31m%}'
logreen=$'%{\e[0;32m%}'
loyellow=$'%{\e[0;33m%}'
loblue=$'%{\e[0;34m%}'
lomagenta=$'%{\e[0;34m%}'
locyan=$'%{\e[0;35m%}'
lowhite=$'%{\e[0;36m%}'

#  export PS1=$'$red[%m:%~]$blue%(2L.+.)%(3L.+.)%(4L.+.)%(5L.+.) $grey'
#  export PS2="$magenta%_ --> $grey"
#  export RPS1="$blue %l  $green%D{%A  %Y/%m/%d  %T} $grey"

#  export prompt="$yellow($blue%n$yellow<$cyan@$yellow>$red%m$yellow($green%/$yellow)$red-$yellow> $white"

##  export PS1="%{$(print -n '\e[1;36m')%}%@, %D{%A %d %B} %m%#%{$(print -n '\e[m')%} "
##  export RPS1="%l %D{%A %y%m%d %T} "
##  export RPS1="%{$(print -n '\e[1;32m')%} %l %D{%A %y%m%d %T} %{$(print -n '\e[m')%}"

export READNULLCMD=most
export REPORTTIME=2
export SAVEHIST=1000
export SLANG_EDITOR=vim

# SPROMPT - the spelling prompt:
export SPROMPT='zsh: correct '%R' to '%r' ?  ([Y]es  [N]o  [E]dit  [A]bort) '

export TCAT="cat >>$HOME/man.ps"      # This doesn't work in NetBSD.
export TMOUT=0       # Setting this to zero supposedly disables auto-logout.
export TMPDIR=/var/tmp/rj
export TROFF="groff -Tps"

export WATCHFMT=" %D       [%B%t%b]       %B%n%b       %a       %B%l%b       from       %B%M%b"
# watch=(all)   ## see everyone who logs in and out of p1.


###########################   END OF FILE   ##############################

-- 
                         // rj@xxxxxxxxx //
Every flower is a Mona Lisa following our glance whenever we look at it.
                 -- Malcolm de Chazal   Sens-Plastique



Messages sorted by: Reverse Date, Date, Thread, Author