zsh-users
 help / color / mirror / code / Atom feed
* sluggish prompt
@ 2007-10-07  4:50 Russell Hoover
  2007-10-07  5:36 ` Atom Smasher
  0 siblings, 1 reply; 11+ messages in thread
From: Russell Hoover @ 2007-10-07  4:50 UTC (permalink / raw)
  To: zsh-users


Lately I've found myself waiting 6, 8 and occasionally 10 seconds
before my zsh prompt re-appears after exiting a program.

Does this mean my .zshrc has become too bloated?

What can I do to get the prompt to return more quickly?

-- 
                         // rj@panix.com //


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: sluggish prompt
  2007-10-07  4:50 sluggish prompt Russell Hoover
@ 2007-10-07  5:36 ` Atom Smasher
  2007-10-07  6:19   ` Russell Hoover
  0 siblings, 1 reply; 11+ messages in thread
From: Atom Smasher @ 2007-10-07  5:36 UTC (permalink / raw)
  To: zsh-users

On Sun, 7 Oct 2007, Russell Hoover wrote:

> Lately I've found myself waiting 6, 8 and occasionally 10 seconds before 
> my zsh prompt re-appears after exiting a program.
>
> Does this mean my .zshrc has become too bloated?
>
> What can I do to get the prompt to return more quickly?
==========================

set -x

and see where it hangs.


-- 
         ...atom

  ________________________
  http://atom.smasher.org/
  762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
  -------------------------------------------------

 	"Fascism should more appropriately be called Corporatism
 	 because it is a merger of State and corporate power."
 		-- Benito Mussolini



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: sluggish prompt
  2007-10-07  5:36 ` Atom Smasher
@ 2007-10-07  6:19   ` Russell Hoover
  2007-10-07  6:33     ` Atom Smasher
  0 siblings, 1 reply; 11+ messages in thread
From: Russell Hoover @ 2007-10-07  6:19 UTC (permalink / raw)
  To: zsh-users

On Sun 10/07/07 at 06:36 PM +1300, Atom Smasher <atom@smasher.org> wrote:

> set -x
> and see where it hangs.


Hmmmmmm.  This caused a scrolling read-out to the terminal of everything
but the kitchen sink and went on for about 3 minutes.  I don't know that
it hung, but after it finished, every time I pressed <RETURN> I got this
(it stopped when I removed "set -x" from my .zshrc) :

[panix1:~]  [v4.3.4]  zsh  1001 -->
+precmd:1> local 'exitstatus=0'
+precmd:2> psvar[1]=SIG
+precmd:3> [[ 0 -ge 128 ]]
+precmd:6> psvar[2]=0
+precmd:6> [[ 0 -eq 0 ]]
+precmd:6> psvar[2]=( )
[panix1:~]  [v4.3.4]  zsh  1001 -->

I have no idea what it means except that "psvar"
is "prmptstring variable."

-- 
                     // rj@panix.com //
  A:  Because it reverses the logical flow of conversation.
  Q:  Why is top posting frowned upon?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: sluggish prompt
  2007-10-07  6:19   ` Russell Hoover
@ 2007-10-07  6:33     ` Atom Smasher
  2007-10-07  7:12       ` Russell Hoover
  0 siblings, 1 reply; 11+ messages in thread
From: Atom Smasher @ 2007-10-07  6:33 UTC (permalink / raw)
  To: zsh-users

On Sun, 7 Oct 2007, Russell Hoover wrote:

>> set -x
>> and see where it hangs.
>
>
> Hmmmmmm.  This caused a scrolling read-out to the terminal of everything 
> but the kitchen sink and went on for about 3 minutes.  I don't know that 
> it hung, but after it finished, every time I pressed <RETURN> I got this 
> (it stopped when I removed "set -x" from my .zshrc) :
====================

another alternative is to set it (set -x) and unset it (set +x) at 
different parts of the rc file... with trial and error you should be able 
to isolate the part that's hanging.

if it's hanging at every prompt (not just when the shell starts) i would 
start with turning on XTRACE within the precmd function. also, is there 
any command substitution in your prompt?

about how big is your ~/.zshrc? did you copy it from somewhere? or did you 
write it yourself? if the latter, you must've either noticed it getting 
getting slower... or you must have done something to make it hang.


-- 
         ...atom

  ________________________
  http://atom.smasher.org/
  762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
  -------------------------------------------------

 	"You do realize that in a year's time I will
 	 have contradicted everything I've said."
 		-- John Lydon



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: sluggish prompt
  2007-10-07  6:33     ` Atom Smasher
@ 2007-10-07  7:12       ` Russell Hoover
  2007-10-07  7:32         ` Atom Smasher
                           ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Russell Hoover @ 2007-10-07  7:12 UTC (permalink / raw)
  To: zsh-users

On Sun 10/07/07 at 07:33 PM +1300, Atom Smasher <atom@smasher.org> wrote:

> if it's hanging at every prompt (not just when the shell starts) i would
> start with turning on XTRACE within the precmd function.

It hangs after any inactivity.  I don't know that I've ever used the
precmd function.  How would I enable XTRACE with it?


> also, is there any command substitution in your prompt?

In the prompt . . . I don't think so.

> about how big is your ~/.zshrc?

290 lines.

> did you copy it from somewhere? or did you write it yourself?

I wrote it slowly myself over several years.  A few isolated segments
were copied.

if the latter, you must've either noticed it getting
> getting slower... or you must have done something to make it hang.

I think I made a few adjustments to the rc recently after starting
to use zsh-3.4.3.  One thing I noticed in the read-out that it kept
repeating all the different filenames for lines 251 & 253 over & over.

Here are those lines:
----------------------------------------------------
248 for dirname in $fpath
249 do
250   for files in $dirname/*(:t)
251   do
252     autoload $files
253   done
254 done
------------------------------------------------------


The lines I quoted that kept repeating whenever I hit return
I now notice are from the rcfile:
-------------------------------------------------------
233 function precmd {
234         local exitstatus=$?
235         psvar[1]=SIG
236         [[ $exitstatus -ge 128 ]] && psvar[1]=SIG$signals[$exitstatus-127]
237 #        [[ $psvar[1] = SIG ]] && psvar[1]=$exitstatus
238 #        jobs % >& /dev/null && psvar[2]=""  || psvar[2]=()
239         psvar[2]=$#jobstates; [[ $psvar[2] -eq 0 ]] && psvar[2]=()
240 }
--------------------------------------------------------

Not sure why the two lines are commented out -- these lines were
definitely copied, though almost all of the rest of the file is not.


At the risk of overkill here's the whole file, thanks for helping:
--------------------------------------------------------------------------
#
#               Russell Hoover's panix .zshrc file for zsh 4.3.4
#               Last update:    2007/09/24    3:01   p.m.    EDT
#
#       From "Intro to Zsh":  ".zshrc is sourced in interactive shells
#       [~/.zshrc is sourced *after* ~/.zprofile.] It should contain
#       commands to set up aliases, functions, options, key bindings, etc."
#
#       Most of the environment variables are set in ~/.zshenv;
#       whatever can't be set there is set here (see below).
#

#  All resource limits are at their default.  Default for coredumpsize
#  is zero. Set core dump anyway, so as to *always* avoid core dump:
#
limit coredumpsize 0                   # This applies to the shell itself.

ulimit -c 0                            # Limits to zero the coredumpsize of core dumped
                                       # by children of the shell but not the shell itself.

umask 077                              # Keeps permissions for group and others off.


bindkey -e                             # Command-line history-events are obtained in
                                       # emacs-mode, using the up & down arrow-keys.

bindkey -s  "^P"	"\rpwd\r"      # Print current working dir & return to the prompt.
bindkey     "^F"	forward-word
bindkey     "^B"	backward-word
bindkey     "^W"	kill-word
bindkey     "^H"	backward-kill-word
bindkey     "^J"	backward-delete-to-slash    # See immediately below.
bindkey    "^[;"	describe-key-briefly
bindkey   "^X^I"	expand-or-complete-prefix

#-------------------------------------->
 backward-delete-to-slash () {
  local WORDCHARS=${WORDCHARS//\//}
  zle .backward-delete-word
 }
 zle -N backward-delete-to-slash
#--------------------------------------<

#  Set here only the environment variables that can't be set in ~/.zshenv
#  (because they'd be overwritten by /etc/zprofile, the panix system
#  config file for zsh.  /etc/zprofile loads *after*  ~/.zshenv):
#
export HISTSIZE=1000
export MAIL=$HOME/.maildir/
export MAILCHECK=10

#  remove duplicate entries from path,cdpath,manpath & fpath:
typeset -U path cdpath manpath fpath

path=( $PATH   /usr/local/bin   /usr/bin   /usr/sbin   /usr/local/sbin   /sbin
/usr/X11R6/bin   /bin   ${HOME}/bin   ${HOME}/.zfunc   /usr/local/contrib/bin )


#  Set up the aliases  (I have a lot of 'em):

# Display the current directory's 30 largest files, from largest to smallest:
alias 30='du -a | sort -nr | head -30'

alias a='alias |less'                 # Display all aliases via the ``less" pager.
alias ap=apropos
alias b=bye

alias c='clear
gls --co=auto -sF'                    # Clear the screen & list current dir at top.

alias cal=gcal                        # Gnu cal is better than cal.
alias cdh='cd /htdocs/userdirs/rj/'

alias dk='c
cl
cal'

alias cp='nocorrect cp -ip'           # No spelling correction on cp; query if overwriting
                                      # an existing file; preserve mode, time & flags etc info.

alias d='dirs -v'                     # Display the directory stack.

alias ee='exec zsh -l'
#alias ss='screen -D -R'
alias f=pfinger
alias find='gfind |m'
alias grep='grep i'                   # ignore case in both pattern & input files.
alias h='history -fD 1 |less'         # Display the command-history stack.

alias j='jobs -l'                     # Display all jobs currently running.
alias _L='last|head -40'              # List top of local lastlog file.

#   Use this next alias for pattern-matching, e.g., 'l *(x)' shows all
#   executable files; 'l *(/)' shows all directories;  'l *(.)' shows all
#   dot files; 'l *(^.)' shows all *non*-dot files, etc:
alias l='gls --co=auto -sdF'

#  File/dir displays, short view (name & block size only):
alias lg='gls --co=auto -dsF .*'      # Dot-files.
alias ls='gls --co=auto  -sF'         # Regular (non-dot) files.
alias ldd='gls --co=auto -adsF *(/)'  # Directories (dot & non-dot).
alias cl='gls --co=auto -asF'         # All files.

#  File/dir displays, full view (permissions, owner, size, date, name):
alias lsd='gls --co=auto -dlF .*'     # Dot-files.
alias la='gls --co=auto -lF'          # Regular (non-dot) files.
alias ll='gls --co=auto -adlF *(/)'   # All dirs (dot & non-dot).
alias lf='gls --co=auto -alFA'        # All files.

alias lh='lf /htdocs/userdirs/rj/'    # List all files in my ~/public_html subdir.

alias lff='lf /var/tmp/rj/'           # List files in my /tmp dir.
alias lft='lf /var/tmp/'

alias lss='gls --co=auto -aSlF'       # Smallest files & dirs.
alias lsb='gls --co=auto -SlF'        # Biggest files & dirs.
alias lsn='gls --co=auto -tlF'        # Newest.

alias m=less                          # Display named file(s) via the less pager.
alias make=gmake
alias ma='most /usr/local/libdata/mutt-1.5.10p1/manual.txt'
alias man='man -m $HOME/man'
alias mc='nw | egrep "mutt*"'
alias md='nocorrect mkdir'            #  no spelling correction on mkdir.
alias mo=most
alias mr='v .muttrc'
alias mt=mutt_slang.new
alias mz='mt -Z'                      # Open mutt to 1st mailbox w/new mail.
alias mv='nocorrect mv -i'            # No spelling correction on mv; query if
                                      # overwriting an existing file.
alias nc=ncftp

# Rename the current dir to specified name (e.g., to
# shorten a long directory name); defined in .zfunc:
alias nd=namedir

alias nl='nlast -urj -start= * -g'    # Show use-pattern chart for named user.
alias nt=nout

alias ping=/sbin/ping

alias pd=pushd              # Put the current dir on the stack & change to a new dir.
alias po=popd               # Pop a dir off the top of the stack & change to it.

alias ps='ps && pstree -u rj -g 2'

alias rd=rmdir              # Remove named directory.
alias rm=safe-rm            # Make rm command safe, with the 'safe-rm' .zfunc file.

sa() {finger " -bhmp $1@panix.com"}

alias sch='most /usr/local/libdata/slrn-0.9.8.0-p1/doc/manual.txt'

# Display current settings of all env variables & options:
alias set='set | m'

# See which staffers are logged in:
alias sf='~mikhail/bin/staff -n'

alias sl='slrn -n'

# Secure-shell login from panix to shore.net:
alias sn='ssh shell.shore.net'

alias s='screen.new -D -R'            # Re-attach to a Gnu/Screen session.
alias sz='sz -uw 2048'          # '-u' unlinks file after successful xmission;
                                # '-w 2048' limits xmit windowsize to 2048 bits.

alias td='nocorrect mkdir /var/tmp/rj'
alias trr=traceroute

alias tree='ls -alsR |less'           # Recursively display all
                                      # files in home dir & subdirs.
alias ua=unalias
alias uc=uncompress
alias v=vim
alias vv='v .vimrc'
alias vx='ssh q@vex.net'
alias vs=q@vex.net
alias w='nw -L|m; nw -R|m'  # Show who's logged on, p1 at top.
alias ww='nw |sort |m'      # Show who's logged on, sorted.

# Show who's online from .friends file:
alias wf='nw | egrep -f .friends |sort |m'

alias wh=weather                                   # Weather for NYC.
alias wj='/users/dman/contrib/rhoosiers |m'        # Show who's logged on by host.


# Shell functions
#
# where to look for autoloaded function definitions:

fpath=(/usr/local/libdata/zsh/4.3.4/functions $HOME/.zfunc)

autoload -U promptinit; promptinit       #  -U = "unique": it tells zsh to keep only
                                         #  the first element of identical copies.

autoload -U is-at-least; is-at-least
autoload -U compinit; compinit
autoload -U colors; colors
#  red="%{${fg[red]}%}"
#  grey="%{${fg[grey]}%}"
#  blue="%{${fg[blue]}%}"

autoload -U zmv

zstyle ':completion:*' verbose yes
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:warnings' format 'No matches for: %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' add-space yes
zstyle ':completion:*:default' list-prompt '%S%l   %m   %p  %s'

## add colors to completions:
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}

##  For maximum completion:
zstyle ':completion:*' completer _complete _list _oldlist _expand _ignored _match _correct _approximate _prefix

## use 'long' to start menu compl. if list is bigger than screen or some number
## to start menu compl. if list has that number of completions (or more):
zstyle ':completion:*' menu select=long
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always


## case-insensitive (uppercase from lowercase) completion
## zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'


function precmd {
        local exitstatus=$?
        psvar[1]=SIG
        [[ $exitstatus -ge 128 ]] && psvar[1]=SIG$signals[$exitstatus-127]
#        [[ $psvar[1] = SIG ]] && psvar[1]=$exitstatus
#        jobs % >& /dev/null && psvar[2]=""  || psvar[2]=()
        psvar[2]=$#jobstates; [[ $psvar[2] -eq 0 ]] && psvar[2]=()
}

# autoload all shell functions in $fpath:

##   [[  To load only those that have the executable bit on (the executable
##   bit isn't necessary, but gives you an easy way to stop the autoloading
##   of a particular function), add  .x  just before the  :t  as in  (.x:t)  ]]

for dirname in $fpath
do
  for files in $dirname/*(:t)
  do
    autoload $files
  done
done


# Set/unset shell options:

setopt always_to_end   append_history
setopt auto_cd   auto_list
setopt auto_param_slash
setopt auto_pushd   auto_remove_slash
setopt auto_resume   no_bad_patterN
setopt no_beep   bg_nice
setopt brace_ccl   cdable_vars
setopt no_clobber   complete_in_word
setopt correct   correct_all
setopt equals   extended_glob
setopt extended_history
setopt glob_complete   glob_dots
setopt glob_subst   hist_allow_clobber
setopt hist_expire_dups_first
setopt hist_ignore_dups
setopt hist_ignore_space   hist_no_store
setopt hist_reduce_blanks   hist_verify
setopt interactive_comments   no_list_beep
setopt list_types   long_list_jobs
setopt no_mail_warning   menu_complete
setopt multibyte   no_nomatch
setopt numeric_glob_sort   path_dirs
setopt prompt_bang   prompt_subst
setopt pushd_ignore_dups
setopt pushd_minus   pushd_silent
setopt pushd_to_home   rc_quotes
setopt rec_exact   no_sun_keyboard_hack

unsetopt single_line_zle


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






-- 
                         // rj@panix.com //


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: sluggish prompt
  2007-10-07  7:12       ` Russell Hoover
@ 2007-10-07  7:32         ` Atom Smasher
  2007-10-07 17:02         ` Bart Schaefer
  2007-10-07 18:04         ` Richard Hartmann
  2 siblings, 0 replies; 11+ messages in thread
From: Atom Smasher @ 2007-10-07  7:32 UTC (permalink / raw)
  To: zsh-users

On Sun, 7 Oct 2007, Russell Hoover wrote:

>> if it's hanging at every prompt (not just when the shell starts) i 
>> would start with turning on XTRACE within the precmd function.
>
> It hangs after any inactivity.  I don't know that I've ever used the 
> precmd function.  How would I enable XTRACE with it?
==============

in the rc file...

stuff
precmd () {
 	set -x		# turn on XTRACE
 	stuff
 	set +x		# turn off XTRACE
}
stuff




-- 
         ...atom

  ________________________
  http://atom.smasher.org/
  762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
  -------------------------------------------------

 	"Workers of the World, Unite!
 	 You have nothing to lose but your chains."
 		-- Karl Marx, 1848



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: sluggish prompt
  2007-10-07  7:12       ` Russell Hoover
  2007-10-07  7:32         ` Atom Smasher
@ 2007-10-07 17:02         ` Bart Schaefer
  2007-10-08  1:46           ` Russell Hoover
  2007-10-07 18:04         ` Richard Hartmann
  2 siblings, 1 reply; 11+ messages in thread
From: Bart Schaefer @ 2007-10-07 17:02 UTC (permalink / raw)
  To: zsh-users

On Oct 7,  3:12am, Russell Hoover wrote:
} Subject: Re: sluggish prompt
} 
} It hangs after any inactivity.

This, and your earlier remark that it happens "after exiting a program",
would tend to indicate that zsh has become swapped out and it's taking
the operating system a long time to swap it back again.  Have you
looked at the output of "ps" (with appropriate options, which vary by
operating system; perhaps "ps up$$" would work) to see how much memory
your shell is consuming?

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?

} I think I made a few adjustments to the rc recently after starting
} to use zsh-3.4.3.  One thing I noticed in the read-out that it kept
} repeating all the different filenames for lines 251 & 253 over & over.

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.

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

} Here are those lines:
} ----------------------------------------------------
} 248 for dirname in $fpath
} 249 do
} 250   for files in $dirname/*(:t)
} 251   do
} 252     autoload $files
} 253   done
} 254 done
} ------------------------------------------------------

I believe you could replace that entire loop with

	autoload ${^fpath}/*(N-.:t)

} The lines I quoted that kept repeating whenever I hit return
} I now notice are from the rcfile:
} -------------------------------------------------------
} 233 function precmd {
} 234         local exitstatus=$?
} 235         psvar[1]=SIG
} 236         [[ $exitstatus -ge 128 ]] && psvar[1]=SIG$signals[$exitstatus-127]
} 237 #        [[ $psvar[1] = SIG ]] && psvar[1]=$exitstatus
} 238 #        jobs % >& /dev/null && psvar[2]=""  || psvar[2]=()
} 239         psvar[2]=$#jobstates; [[ $psvar[2] -eq 0 ]] && psvar[2]=()
} 240 }
} --------------------------------------------------------
} 
} Not sure why the two lines are commented out -- these lines were
} definitely copied, though almost all of the rest of the file is not.

They're probably commented out because they are a cruder/older way to
accomplish the equivalent of the one line following them.
 
} At the risk of overkill here's the whole file, thanks for helping:

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?

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: sluggish prompt
  2007-10-07  7:12       ` Russell Hoover
  2007-10-07  7:32         ` Atom Smasher
  2007-10-07 17:02         ` Bart Schaefer
@ 2007-10-07 18:04         ` Richard Hartmann
  2 siblings, 0 replies; 11+ messages in thread
From: Richard Hartmann @ 2007-10-07 18:04 UTC (permalink / raw)
  To: zsh-users

On 07/10/2007, Russell Hoover <rj@panix.com> wrote:

> At the risk of overkill here's the whole file, thanks for helping:

It is always good to get a chance to steal :)

What is the gls command you refer to quite frequently? What does it
do?

As a side note, I _highly_ recommend using a version control system to
track your RC files. You can easily sync stuff and test for regressions quite
easily :)


Richard


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: sluggish prompt
  2007-10-07 17:02         ` Bart Schaefer
@ 2007-10-08  1:46           ` Russell Hoover
  2007-10-08  3:57             ` Bart Schaefer
  0 siblings, 1 reply; 11+ messages in thread
From: Russell Hoover @ 2007-10-08  1:46 UTC (permalink / raw)
  To: zsh-users


On Sun 10/07/07 at 10:02 AM -0700,
Bart Schaefer <schaefer@brasslantern.com> 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@panix.com //
Every flower is a Mona Lisa following our glance whenever we look at it.
                 -- Malcolm de Chazal   Sens-Plastique


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: sluggish prompt
  2007-10-08  1:46           ` Russell Hoover
@ 2007-10-08  3:57             ` Bart Schaefer
       [not found]               ` <20071009185552.GA12388@panix.com>
  0 siblings, 1 reply; 11+ messages in thread
From: Bart Schaefer @ 2007-10-08  3:57 UTC (permalink / raw)
  To: zsh-users

On Oct 7,  9:46pm, Russell Hoover wrote:
}
} On Sun 10/07/07 at 10:02 AM -0700,
} Bart Schaefer <schaefer@brasslantern.com> 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.

The absolute memory use is the RSS column: 2608 KB.  That's about the
same as my RSS here, on a workstation where I'm the only user.  On the
other hand, my VSZ (virtual memory size) is 6636 KB compared to your
800 KB, so I don't think you're doing anything unusual.

} 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.

Well, if you're one of more than 500 users and each of you is consuming
0.2% of the system memory, then *somebody* is going to have to get
swapped out -- and that doesn't even consider all the memory that is
being occupied by other programs that all those users are running.
The longer a process is idle, the more completely it gets swapped out,
and the longer it takes to come back.  When you say:

} 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.

That sounds *exactly* like an idle process being swapped out and then
taking a short while to swap back in again when it is no longer idle.

A shell that's been waiting for an external command to exit is similarly
idle and thus also a candidate for swapping.

(However, one symptom does not a diagnosis make.)

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

Wrong context.  I meant "If, when you have set -x in your .zshrc, and
you see the list of files in your fpath being printed by the nested
for-loops, that output does not appear every time, then it's not
something to worry about."  I was not talking about the 6-10 second
delay when I said "only at startup" in that sentence.

} 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.

OK, but that's not all that interesting.  What we need to know is, on
every *subsquent* prompt, as you go through your normal habitual use
of zsh on this system, do you see delays before PRECMD is printed or
in between PRECMD and the prompt?

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

Nothing exciting there ... but I went back and looked at your .zshrc
file again and noticed this:

export MAIL=$HOME/.maildir/
export MAILCHECK=10

Do you have a lot of mail?  Is it on an NFS filesystem that might be
slow to respond?  If you set MAILCHECK to a much larger value, does
the delay become less frequent?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: sluggish prompt
       [not found]               ` <20071009185552.GA12388@panix.com>
@ 2007-10-11 15:45                 ` Bart Schaefer
  0 siblings, 0 replies; 11+ messages in thread
From: Bart Schaefer @ 2007-10-11 15:45 UTC (permalink / raw)
  To: zsh-users

On Oct 9,  2:55pm, Russell Hoover wrote:
} Subject: Re: sluggish prompt
}
} On Sun 10/07/07 at 08:57 PM -0700,
} Bart Schaefer <schaefer@brasslantern.com> wrote:
} 
} > [...] I meant "If, when you have set -x in your .zshrc, and you see
} > the list of files in your fpath being printed by the nested for-loops,
} > that output does not appear every time,
} 
} It did appear every time until I replaced the for-loop lines with the
} single line you suggested.

Something odd is happening, then, because your .zshrc should not be
getting re-loaded every time a prompt is printed.  I didn't see any
indication that this would be happening in the files you posted.  Is
there something in any of the corresponding /etc/z* files?
 
} > What we need to know is, on every *subsquent* prompt, as you go
} > through your normal habitual use of zsh on this system, do you see
} > delays before PRECMD is printed or in between PRECMD and the prompt?
} 
} They're between the appearance of "PRECMD" and the appearance of the
} prompt.

That's a clue; it means its something that happens after precmd is run
but before the prompt is output.  That can only be (1) watching for new
users to log in (you have WATCHFMT set, I see), (2) checking for mail
(see previous discussion of MAILCHECK), or (3) a scheduled task from the
"sched" module.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-10-11 15:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-07  4:50 sluggish prompt Russell Hoover
2007-10-07  5:36 ` Atom Smasher
2007-10-07  6:19   ` Russell Hoover
2007-10-07  6:33     ` Atom Smasher
2007-10-07  7:12       ` Russell Hoover
2007-10-07  7:32         ` Atom Smasher
2007-10-07 17:02         ` Bart Schaefer
2007-10-08  1:46           ` Russell Hoover
2007-10-08  3:57             ` Bart Schaefer
     [not found]               ` <20071009185552.GA12388@panix.com>
2007-10-11 15:45                 ` Bart Schaefer
2007-10-07 18:04         ` Richard Hartmann

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).