From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9358 invoked by alias); 6 Apr 2012 18:40: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: 16994 Received: (qmail 4078 invoked from network); 6 Apr 2012 18:39:45 -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 autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at mugenguild.com does not designate permitted sender hosts) Date: Fri, 6 Apr 2012 20:30:22 +0200 From: Valodim Skywalker To: zsh-users@zsh.org Subject: Re: Large LS_COLORS makes auto_cd very slow Message-ID: <20120406183022.GA11651@mugenguild.com> Mail-Followup-To: zsh-users@zsh.org References: <120404005237.ZM10249@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2fHTh5uZTiUOsy+g" Content-Disposition: inline In-Reply-To: <120404005237.ZM10249@torch.brasslantern.com> User-Agent: Mutt/1.5.21 (2010-09-15) --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > For each of these categories, _setup line 12 rebuilds the value of > the _comp_colors array to add new patterns such that any pattern that > started with '=3D' gets copied with a prefix matching the tag currently > being tested; e.g. '(commands)=3D...' or '(jobs)=3D...' >=20 > This is done even for tags that won't have any matches because the > colors array has to be ready for the internals to use when a match is > found, there's no way to "call back" to build it on demand. >=20 > The expensive bit is that _comp_colors is declared as a unique array, > so every time it gets rebuilt the resulting 1700+ entries are all > compared against one another to make sure there is no duplication. > Repeat that nine times and it takes a while. Are these steps all hard requirements? I don't have a good overview of things, but some of these parts seem like they could be rethought to work faster or the cpu/memory tradeoff shifted a bit towards more memory use or something. Does the array really need to be unique? How much fluctuation is in these contexts, this is a frequent operation so maybe caching the entries, possibly only for known often called contexts, could help? - V --2fHTh5uZTiUOsy+g Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAk9/Nj4ACgkQxCa+aHUWYdR9zQCg0ON5pRFctThAcNYw5vE7eqIQ kY0AnRbfX/YpJ3ZljyJoMZKCR9oUsmKk =QcfS -----END PGP SIGNATURE----- --2fHTh5uZTiUOsy+g--