zsh-users
 help / color / mirror / code / Atom feed
From: gi1242+zsh@gmail.com
To: zsh-users@zsh.org
Subject: Re: "Once-a-day" long delay before startup
Date: Thu, 18 Aug 2011 22:03:37 -0400	[thread overview]
Message-ID: <20110819020336.GA21062@andrew.cmu.edu> (raw)
In-Reply-To: <4E4D8D50.5040800@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2055 bytes --]

On Fri, Aug 19, 2011 at 12:08:16AM +0200, Piotr Karbowski wrote:

> Hi, I have pretty much the same issue, the first login after boot, to  
> each user take about 8-9s.
>
> In order to check whats going on I changed my login shell to bash and did:
>
> zsh -x 2>&1 | tee zsh-startup.log
>
> In order to save logs and I careful watch what pop up onto screen. I
> have reproduced it few times, what you need to reproduce is reboot
> system or drop_cache (echo 3 > /proc/sys/vm/drop_caches) and then
> again  run zsh as user.

That's a neat trick. It reproduces the behaviour for me every time.

It appears that building the command hash is the time consuming step.

Here's what I did:

    1. I created /tmp/.zshrc containing only

	    print -P "${ZSH_NAME}-${ZSH_VERSION} ($ZSH_PATCHLEVEL)"
	    which dircolors

    2. I executed the commands
    
	sudo echo 3 > /proc/sys/vm/drop_caches
	ZDOTDIR=/tmp zsh -xd 2>&1 | tee /tmp/zsh.log

I saw the output

	+/etc/zsh/zshenv:15> [[ -z .:/home/gautam/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/games || .:/home/gautam/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/games == /bin:/usr/bin ]]
	+/tmp/.zshrc:1> print -P 'zsh-4.3.12 (Debian)'
	zsh-4.3.12 (Debian)
	+/tmp/.zshrc:3> which dircolors
	/usr/bin/dircolors

Once "which dircolors" appears on screen, I see a long long long pause
(with the hard disk constantly spinning). After a long long long time, I
finally see the output (/usr/bin/dircolors) appear.

For comparison, I also executed the following

    sudo echo 3 > /proc/sys/vm/drop_caches
    sh
    which dircolors

"sh" started instantly, and which dircolors executed instantly. I also
checked that under the above conditions, the PATH in both sh and zsh
were identical.

I've no idea why "which dircolors" takes such a long time on zsh (when
the cache is cleared), and runs instantly on sh. I'd appreciate any
help.

Thanks,

GI

-- 
Freedom of speech is wonderful - right up there with the freedom not to
listen.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2011-08-19  2:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-14 14:57 gi1242+zsh
2011-08-14 15:36 ` Vincent Lefevre
2011-08-14 17:32   ` Vincent Lefevre
2011-08-14 18:06 ` Bart Schaefer
2011-08-18 22:08 ` Piotr Karbowski
2011-08-19  2:03   ` gi1242+zsh [this message]
2011-08-19  4:05     ` Bart Schaefer
2011-08-19  9:08       ` Vincent Lefevre
2011-08-19 17:58         ` Bart Schaefer
2011-08-20  0:47       ` gi1242+zsh
2011-08-20  7:01         ` Bart Schaefer
2011-08-19  3:52   ` Bart Schaefer
2011-08-19  8:36     ` Vincent Lefevre
2011-08-19  9:05     ` Piotr Karbowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110819020336.GA21062@andrew.cmu.edu \
    --to=gi1242+zsh@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).