From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: 3.1.5-pws-8: dumping completions for speed
Date: Tue, 16 Feb 1999 15:23:38 +0100 (MET) [thread overview]
Message-ID: <199902161423.PAA02542@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Peter Stephenson's message of Mon, 15 Feb 1999 15:46:31 +0100
Peter Stephenson wrote:
> The following patch adds a file `dump' to the Functions/Completions
> directory. This dumps out all the state information which the `init' file
> there has produced, so that for subsequent shell initialisations it can all
> be read in in one go. This speeds up my total shell startup time including
> the new completions by a factor of around two, though I haven't timed it
> properly. You just dot it and put the out put in $foo.dump, where $foo is
> where the file called Functions/Completions/init in the distribution lives
> in your setup; sourcing $foo finds $foo.dump automatically.
Yes, it was inacceptably slow. I had some problems with this, though:
in one place in `dump' print wasn't used with a `-' which failed for
me because in the `${(ov)...}' that came after it I need a `@' -- see
the patch below, which adds lots of `-'s, just to make sure... (haven't
checked it, but I guess in most places they are not needed). Also in
`init' we probably should use `builtin .' since users may have an
alias/function for it.
> ...
>
> 4) I just made it check for $0.dump in init, so if it had to search the
> path for init, it won't find init.dump (that's why perl sets $0 to a full
> path name).
How about making this the default, but if the user has set a parameter
(COMPDUMP or something) and that contains the name of a file, source
that one?
Bye
Sven
diff -u of/Completion/dump Functions/Completion/dump
--- of/Completion/dump Tue Feb 16 15:03:00 1999
+++ Functions/Completion/dump Tue Feb 16 15:15:43 1999
@@ -42,7 +42,7 @@
zle -lL |
while read -A __d_line; do
if [[ ${__d_line[5]} = __main_key_complete ]]; then
- print ${__d_line}
+ print - ${__d_line}
__d_bks=($__d_bks ${__d_line[3]})
fi
done
@@ -62,7 +62,7 @@
__d_als=($(whence -wm '__*' |
while read -A __d_line; do
- [[ ${__d_line[2]} = function ]] && print ${__d_line[1]%:}
+ [[ ${__d_line[2]} = function ]] && print - ${__d_line[1]%:}
done))
# print them out: about six to a line looks neat
@@ -102,7 +102,7 @@
fi
done
-print -l ${(ov)__d_zle}
-print "$__d_bks"
+print -l - "${(@ov)__d_zle}"
+print - "$__d_bks"
unset __d_line __d_zle __d_bks __d_als __d_f
diff -u of/Completion/init Functions/Completion/init
--- of/Completion/init Tue Feb 16 15:03:00 1999
+++ Functions/Completion/init Tue Feb 16 15:17:34 1999
@@ -210,7 +210,7 @@
if [[ -f $0.dump ]]; then
- . $0.dump
+ builtin . $0.dump
else
# Now we make the files automatically autoloaded.
for __i_dir in $fpath; do
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1999-02-16 14:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-02-16 14:23 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
1999-02-16 15:15 Sven Wischnowsky
1999-02-15 14:46 Peter Stephenson
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=199902161423.PAA02542@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/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).