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

Re: Speeding up ZSH startup



sorry if gmail messes up the To: and Cc: here...

On 4/23/05, Andrey Borzenkov <arvidjaar@xxxxxxxxxx> wrote:
> On Saturday 23 April 2005 10:29, Meino Christian Cramer wrote:
> > Hi,
> >
> >  I am at the very beginning of dvinig deeper into the wonderful world
> >  of ZSH :O)...
> >
> >  I want to speed up the start of zsh on my Linux system.
> >  WIth "zsh -x" I figured out what file are loaded when and I found no
> >  abnormal things (reloading and such...). The different fiel, which
> >  got loaded are of "normal" size (so nothing VERY big...).
> >
> >  Is there any other things or tricks I can try to make starting zsh a
> >  little faster ?
> >
> 
> If you use "new" completion (compinit) then the slowest part is reading and
> parsing all completion functions.
> 
> You can speed it up by precompiling; see zcompile and function autoloading in
> Zsh manuals.
> 
> I do something like
> 
> for i in $fpath; do
>   zcompile $i $i/*(N)
> done

I have this function that i call from time to time manually as root
and my user (the one for my user doesn't have the systemwide files),

src () {
	autoload -U zrecompile
	[ -f ~/.zshrc ] && zrecompile -p ~/.zshrc
	[ -f ~/.zlogout ] && zrecompile -p ~/.zlogout
	[ -f ~/.zlogin ] && zrecompile -p ~/.zlogin
	[ -f ~/.zcompdump ] && zrecompile -p ~/.zcompdump
	[ -f /etc/profile ] && zrecompile -p /etc/profile
	[ -f /etc/profile.env ] && zrecompile -p /etc/profile.env
	for a in $fpath
	do
		[ -d $a ] && zrecompile -p $a.zwc $a/*
	done
}

> and wrapper function that checks modification time to automatically recompile
> if needed.
> 
> >  For example: Are there feature known, which are better to be
> >  activated at last/at first...
> >
> 
> it depends on your rc files actually. Ubuntu ships zero rc files for zsh and
> startup is very fast :)
> 
> -andrey
> 
> 
> 


-- 
Mikael Magnusson



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