From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7355 invoked by alias); 9 Apr 2012 19:29:00 -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: 17000 Received: (qmail 23020 invoked from network); 9 Apr 2012 19:28:57 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) 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.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <120409122824.ZM28194@torch.brasslantern.com> Date: Mon, 09 Apr 2012 12:28:24 -0700 In-reply-to: =?iso-8859-1?Q?=3C4F829C94=2E2010606=40gmail=2Ecom=3E?= =?iso-8859-1?Q?Comments=3A_In_reply_to_V=E1clav_Zeman_=3Cvhaisman=40gmail?= =?iso-8859-1?Q?=2Ecom=3E?= =?iso-8859-1?Q?________=22Re=3A_Large_LS_COLORS_makes_auto_cd_very_slow?= =?iso-8859-1?Q?=22_=28Apr__9=2C_10=3A23am=29?= References: <120404005237.ZM10249@torch.brasslantern.com> <120405085125.ZM13673@torch.brasslantern.com> <4F829C94.2010606@gmail.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Large LS_COLORS makes auto_cd very slow MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: quoted-printable On Apr 9, 10:23am, V=E1clav Zeman wrote: } } > I have reimplemented the change using ZSH's own hash table. Please see } > the attached patch. } > } I have put the changes onto github: Unfortunately on some further testing it doesn't quite work properly. You can't declare struct hashnode new_node; and then call addhashnode2(ht, *it, &new_node); because a pointer to new_node will be placed in the hash table and then THE CONTENTS OF new_node will be overwritten on the next call to addhashnode2().=20=20 You have to pass allocated space. It can be allocated with zhalloc() so that it needn't be explicitly free()d. The good news is that fixing this makes completion after "/b" much faster! The getcoldef() issue that we discussed before turns out to have been happening because the hash seive was failing to remove all the duplicate elements, not because of any inherent problem with getcoldef(). I'll commit a repaired version later. Now the question is at what array length it makes sense to switch from the simple algorithm to the hash seive. I suspect V=E1clav's choice of 10 elements may be a little too small given allocation overhead, but I will leave it that way for the first commit because it's easier to write the Test/D04parameter.ztst entry for a small number of elements. --=20 Barton E. Schaefer