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

Re: "Once-a-day" long delay before startup



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: signature.asc
Description: Digital signature



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