From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27576 invoked by alias); 19 Aug 2011 04:06:15 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16267 Received: (qmail 29113 invoked from network); 19 Aug 2011 04:06:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110818210558.ZM20788@torch.brasslantern.com> Date: Thu, 18 Aug 2011 21:05:58 -0700 In-reply-to: <20110819020336.GA21062@andrew.cmu.edu> Comments: In reply to gi1242+zsh@gmail.com "Re: "Once-a-day" long delay before startup" (Aug 18, 10:03pm) References: <20110814145749.GA6341@andrew.cmu.edu> <4E4D8D50.5040800@gmail.com> <20110819020336.GA21062@andrew.cmu.edu> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: "Once-a-day" long delay before startup MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Aug 18, 10:03pm, gi1242+zsh@gmail.com 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.