From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6412 invoked by alias); 19 Aug 2011 17:58:59 -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: 16271 Received: (qmail 5160 invoked from network); 19 Aug 2011 17:58:56 -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: <110819105827.ZM21713@torch.brasslantern.com> Date: Fri, 19 Aug 2011 10:58:27 -0700 In-reply-to: <20110819083624.GD1685@prunille.vinc17.org> Comments: In reply to Vincent Lefevre "Re: "Once-a-day" long delay before startup" (Aug 19, 10:36am) References: <20110814145749.GA6341@andrew.cmu.edu> <4E4D8D50.5040800@gmail.com> <110818205236.ZM20722@torch.brasslantern.com> <20110819083624.GD1685@prunille.vinc17.org> <20110819020336.GA21062@andrew.cmu.edu> <110818210558.ZM20788@torch.brasslantern.com> <20110819090844.GF1685@prunille.vinc17.org> In-reply-to: <20110819090844.GF1685@prunille.vinc17.org> Comments: In reply to Vincent Lefevre "Re: "Once-a-day" long delay before startup" (Aug 19, 11:08am) 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 19, 10:36am, Vincent Lefevre wrote: } Subject: Re: "Once-a-day" long delay before startup } } That can be annoying. But I don't really understand. What if none } of the concerned directories are group-writable? I suppose that } getent should be useless. Why not calling it only when needed? The test is written to find the directories that are both writable and owned by the user/group in a single glob pass. It comes down to predicting whether two globs are slower than one getent, which isn't practical. But the test could be rewritten. On Aug 19, 11:08am, Vincent Lefevre wrote: } } With HASH_DIRS, couldn't zsh fill the hash table only when the } directory is accessed? Yes, that is what it does, except during completion when it fills the whole thing so as not to miss some possible completions. But whether incremental filling is any faster depends on the order of the path and where the command is found in it. Again the optimization chosen years ago was for commands you have yet to use; a better one nowadays might be to assume command use is mostly repetitive and only store individual commands as they are found. Except, again, for the completion issue, which usually makes all of this discussion moot. } Now, if zsh could fill the hash tables in background, this would be } even better. That could require completely rewriting the way the shell interacts with the user for I/O -- I'm not even sure it's possible to maintain POSIX compliance and do that. Shells generally don't support shared memory multithreading, and you'd still have to wait for the table to be completely filled when completion begins, so you need a sempahore as well. However, it might be possible to *cache* the hash table in a manner similar to the way completion caches work.