Subject: patch 5.4.33 (was: Vim 5.4 *way* slower than 5.3 -> solution found!)
From: Bram Moolenaar <[email-masked]>
To: "C. Laurence Gonsalves" <[email-masked]>
Cc: [email-masked]

------------

C. Laurence Gonsalves wrote:

> After doing lots of tests, I have finally found out the cause of the
> problem.
[...]
> 1. start up vim 5.4 (with "clean" .vimrc)
> 2. type ':e <Tab>'. (this is just to load the cache)
> 3. hit <Esc>
> 4. type ':e <Tab>' again. A filename should appear instantly.
> 5. hit <Esc>
> 6. Type ':echo expand("$KLHJGSKLJSHKLJHSKLJHSKLJHS")<CR>'. This takes a
>    second or two on my SPARC.
> 7. type ':e <Tab>' again. On my SPARC it takes a couple of seconds. On
>    my Linux box, it's still quite fast, but I do see '...' appear for a
>    fraction of a second before the filename, while in step 4 the
>    filename apperaed instantly (no noticable '...').

I found the problem for the slowness at point 7.  A flag was not reset
properly.

The other slowdowns are caused by the shell being used for expanding
variables.  This was added to be compatible with Vi.  To avoid that, don't use
expand("$VAR") but $VAR directly.

Patch 5.4.33
Problem:    Unix: After expanding an environment variable with the shell, the
	    next expansion would also use the shell, even though it is not
	    needed.
Solution:   Reset "recursive" before returning from gen_expand_wildcards().
Files:	    src/misc1.c

*** ../vim-5.4.32/src/misc1.c	Thu Aug 12 23:40:39 1999
--- src/misc1.c	Tue Aug 17 23:06:58 1999
***************
*** 5416,5423 ****
  		{
  		    vim_free(p);
  		    ga_clear(&ga);
! 		    return mch_expand_wildcards(num_pat, pat, num_file, file,
  								       flags);
  		}
  #endif
  	    }
--- 5417,5426 ----
  		{
  		    vim_free(p);
  		    ga_clear(&ga);
! 		    i = mch_expand_wildcards(num_pat, pat, num_file, file,
  								       flags);
+ 		    recursive = FALSE;
+ 		    return i;
  		}
  #endif
  	    }
*** ../vim-5.4.32/src/version.h	Tue Aug 17 21:24:28 1999
--- src/version.h	Tue Aug 17 23:02:59 1999
***************
*** 19,26 ****
  #define VIM_VERSION_MINOR_STR		"4"
  #define VIM_VERSION_BUILD		 57
  #define VIM_VERSION_BUILD_STR		"57"
! #define VIM_VERSION_PATCHLEVEL		 32
! #define VIM_VERSION_PATCHLEVEL_STR	"32"
  
  /*
   * VIM_VERSION_NODOT is used for the runtime directory name.
--- 19,26 ----
  #define VIM_VERSION_MINOR_STR		"4"
  #define VIM_VERSION_BUILD		 57
  #define VIM_VERSION_BUILD_STR		"57"
! #define VIM_VERSION_PATCHLEVEL		 33
! #define VIM_VERSION_PATCHLEVEL_STR	"33"
  
  /*
   * VIM_VERSION_NODOT is used for the runtime directory name.
***************
*** 30,35 ****
   */
  #define VIM_VERSION_NODOT	"vim54"
  #define VIM_VERSION_SHORT	"5.4"
! #define VIM_VERSION_MEDIUM	"5.4.32"
! #define VIM_VERSION_LONG	"VIM - Vi IMproved 5.4.32 (1999 Aug 17)"
! #define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 5.4.32 (1999 Aug 17, compiled "
--- 30,35 ----
   */
  #define VIM_VERSION_NODOT	"vim54"
  #define VIM_VERSION_SHORT	"5.4"
! #define VIM_VERSION_MEDIUM	"5.4.33"
! #define VIM_VERSION_LONG	"VIM - Vi IMproved 5.4.33 (1999 Aug 17)"
! #define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 5.4.33 (1999 Aug 17, compiled "

--
hundred-and-one symptoms of being an internet addict:
120. You ask a friend, "What's that big shiny thing?" He says, "It's the sun."

--/-/---- Bram Moolenaar ---- [email-masked] ---- [email-masked] ---\-\--
  \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /