oops.

---------------------
function executable() is too slow on windows. it seems that using
SearchPath() API.
SearchPath() tries following sequence if lpPath was set NULL.
---------------------

On Fri, Jan 30, 2009 at 3:12 PM, Yasuhiro MATSUMOTO <mattn...@gmail.com> wrote:
> Hi, bram and all.
>
> function executable() is too slow on windows. it seems that using
> SearchPath() API.
> SearchPath() tries following sequence if lp.
>
> 1. Location at executable.
> 2. Current directory
> 3. Windows System Direction which can get with GetSystemDirectory().
> 4. Windows Directory.
> 5. Specified as PATH environment variable.
>
> * see remarks at
> http://msdn.microsoft.com/en-us/library/aa365527%28VS.85%29.aspx
>
> I guess that No3, No4, No5 is duplicated and I guess that No5 include
> No3 and No4.
> For size, I tried following patch and function executable() had few
> speed-up. :-)
> If i use netrw.vim then it took 3 seconds for getting password prompt
> from type ':e ftp://xxx'.
> But it took 1.5 seconds for them with following patch.
>
> Thanks.
>
> Index: src/os_win32.c
> ===================================================================
> --- src/os_win32.c      (revision 1326)
> +++ src/os_win32.c      (working copy)
> @@ -1594,7 +1594,7 @@
>
>        if (p != NULL)
>        {
> -           n = (long)SearchPathW(NULL, p, NULL, _MAX_PATH, fnamew, &dumw);
> +           n = (long)SearchPathW(_wgetenv(L"PATH"), p, NULL, _MAX_PATH,
> fnamew, &dumw);
>            vim_free(p);
>            if (n > 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
>            {
> @@ -1608,7 +1608,7 @@
>        }
>     }
>  #endif
> -    if (SearchPath(NULL, name, NULL, _MAX_PATH, fname, &dum) == 0)
> +    if (SearchPath(getenv("PATH"), name, NULL, _MAX_PATH, fname, &dum) == 0)
>        return FALSE;
>     if (mch_isdir(fname))
>        return FALSE;
>
>
> --
> - Yasuhiro Matsumoto
>



-- 
- Yasuhiro Matsumoto

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui