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

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



On Aug 18, 10:03pm, gi1242+zsh@xxxxxxxxx wrote:
}
} 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.

sh doesn't do command hashing, it re-searches the path every time.

Refer to my earlier reply -- do as soon as possible during startup:

    unsetopt hashcmds hashdirs hashlistall

On my system "zsh -fc 'which ...'" takes about 40% as long with those
options unset as it does with them set.

Zsh is making the assumption that you'd prefer one big delay of a few
seconds at startup, to many tiny delays all the while the shell is
running.  However, zsh's default options were determined in a time
when path searching was slow and those "tiny" delays were a lot less
tiny.  Of course the tradeoff for getting your prompt sooner is that
you're going to have a delay the first time you attempt command
completion, because completion needs a filled hash table.



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