From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 474 invoked from network); 16 Feb 1999 14:25:18 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 16 Feb 1999 14:25:18 -0000 Received: (qmail 12805 invoked by alias); 16 Feb 1999 14:24:48 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5400 Received: (qmail 12798 invoked from network); 16 Feb 1999 14:24:46 -0000 Date: Tue, 16 Feb 1999 15:23:38 +0100 (MET) Message-Id: <199902161423.PAA02542@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Peter Stephenson's message of Mon, 15 Feb 1999 15:46:31 +0100 Subject: Re: PATCH: 3.1.5-pws-8: dumping completions for speed 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