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: Sat, 07 Apr 2012 09:43:05 -0700	[thread overview]
Message-ID: <120407094305.ZM20365@torch.brasslantern.com> (raw)
In-Reply-To: <20120406183022.GA11651@mugenguild.com>

On Apr 6,  8:30pm, Valodim Skywalker wrote:
} 
} > 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 '=' gets copied with a prefix matching the tag currently
} > being tested; e.g. '(commands)=...' or '(jobs)=...'
} > 
} > 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.
} 
} 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?

Using the hash seive for arrayuniq seems to resolve that part of the
problem.  The array doesn't have to be unique, but making it not so will
only make the other part of the problem [getcoldef()] worse.

} 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?

It's conceivable that getcoldef() could use a cache.  The parse of each
string passed to getcoldef() is not dependent on context, although the
strings themselves are, so getcoldef() could just stash away every one
it ever sees and return it the next time the same parse is needed.

All the heap allocations [zhalloc()] in getcoldef() would have to become
global allocations [zcalloc()], patcompile() would need to be called
with the PAT_ZDUP flag, and the module boot_() and cleanup_() routines
would then allocate and delete a hash table for the cache.

However, this would only help on second and subsequent completions in
a context that had been completed before.  E.g., the first completion
after "/b" in command position would still have a noticable delay; it
checks at least eight different contexts.


  reply	other threads:[~2012-04-07 16:43 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
2012-04-06 18:30   ` Valodim Skywalker
2012-04-07 16:43     ` Bart Schaefer [this message]
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=120407094305.ZM20365@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).