zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Large LS_COLORS makes auto_cd very slow
Date: Mon, 09 Apr 2012 12:28:24 -0700	[thread overview]
Message-ID: <120409122824.ZM28194@torch.brasslantern.com> (raw)
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?=

On Apr 9, 10:23am, Václav 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: <git://github.com/wilx/zsh.git>

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().  

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áclav'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.

-- 
Barton E. Schaefer


  reply	other threads:[~2012-04-09 19:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-03 19:08 Jesper Nygårds
2012-04-04  7:52 ` Bart Schaefer
2012-04-04 16:57   ` Jesper Nygårds
2012-04-05  9:30   ` Václav Zeman
2012-04-05 15:51     ` Bart Schaefer
2012-04-05 16:33       ` Bart Schaefer
2012-04-05 17:00         ` Philippe Troin
2012-04-06  9:49       ` Václav Zeman
2012-04-06 11:07         ` Mark van Dijk
2012-04-06 15:51         ` Bart Schaefer
2012-04-09  8:23         ` Václav Zeman
2012-04-09 19:28           ` Bart Schaefer [this message]
2012-04-06 18:30   ` Valodim Skywalker
2012-04-07 16:43     ` Bart Schaefer
2013-01-11 11:30 Completing all possible candidates Jesper Nygårds
2013-01-11 14:32 ` Bart Schaefer
2013-01-15  7:28   ` Jesper Nygårds
2013-01-17  3:14     ` Bart Schaefer
2013-01-17  6:28       ` Jesper Nygårds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=120409122824.ZM28194@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).