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

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

On Aug 14, 10:57am, gi1242+zsh@xxxxxxxxx wrote:
} I notice that about every so often (at least once a day) when I open a
} new shell, my hard disk spins for 15 secs or so before zsh starts.

Per Vincent's remarks, you should determine whether the delay comes
before zsh even begins reading its startup files, or sometime during.

} Would anyone know what the problem is? I'm guessing it's from
} reading/recreating the completion cache.

If by "the completion cache" you mean the ~/.zcompdump file, I'd say
that's unlikely to be related.  However, it could have to do with
building the command hash table (scanning the directories in $path),
particularly if you have run some sort of memory-intensive operation
that may have caused the kernel to flush out part of its filesystem
cache.  There are various setopts to encourage that scan to be done
incrementally, but if your startup files include external commands
that are found in directories toward the end of the search path, all
the preceding directories are likely to get scanned anyway.

You might try placing

    unsetopt hashcmds hashdirs hashlistall

at the beginning of ~/.zshenv and make sure you don't set any of those
nor correct and correctall until as late as possible in ~/.zshrc.  This
will help assure that the hash table is not rebuilt during startup file
processing (unless of course you're explicitly "rehash"ing somewhere)
and is never built during non-interactive scripts.

Of course if /etc/zshenv is doing something intensive that's not going
to help.

The hashlistall option mostly applies to compctl, not compsys, so you
can probably leave it unset.

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