Hi,

Following the other email on new regex performance here is a patch that remove the memory available check on Win32 (i.e. XP, Vista, etc.) It's accuracy was questionable on Win32 (numbers returned will most likely be out of date by the time it is used), the system will be on its knees by the time there is just 8KB left, and so on. It provides a performance boost in memory allocation intensive operations (e.g. new regex engine)

diff --git a/src/os_win32.c b/src/os_win32.c
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -5048,37 +5048,6 @@ mch_breakcheck(void)
 }


-/*
- * How much memory is available in Kbyte?
- * Return sum of available physical and page file memory.
- */
-/*ARGSUSED*/
-    long_u
-mch_avail_mem(int special)
-{
-#ifdef MEMORYSTATUSEX
-    PlatformId();
-    if (g_PlatformId == VER_PLATFORM_WIN32_NT)
-    {
-       MEMORYSTATUSEX  ms;
-
-       /* Need to use GlobalMemoryStatusEx() when there is more memory than
-        * what fits in 32 bits. But it's not always available. */
-       ms.dwLength = sizeof(MEMORYSTATUSEX);
-       GlobalMemoryStatusEx(&ms);
-       return (long_u)((ms.ullAvailPhys + ms.ullAvailPageFile) >> 10);
-    }
-    else
-#endif
-    {
-       MEMORYSTATUS    ms;
-
-       ms.dwLength = sizeof(MEMORYSTATUS);
-       GlobalMemoryStatus(&ms);
-       return (long_u)((ms.dwAvailPhys + ms.dwAvailPageFile) >> 10);
-    }
-}
-
 #ifdef FEAT_MBYTE
 /*
  * Same code as below, but with wide functions and no comments.
diff --git a/src/os_win32.h b/src/os_win32.h
--- a/src/os_win32.h
+++ b/src/os_win32.h
@@ -80,7 +80,6 @@
 #ifndef FEAT_GUI_W32           /* GUI works different */
# define BREAKCHECK_SKIP 1 /* call mch_breakcheck() each time, it's fast */
 #endif
-#define HAVE_AVAIL_MEM

 #define HAVE_PUTENV            /* at least Bcc 5.2 and MSC have it */


Recommended to the house.

Mike
--
This is certainly more fun than being hit with a hammer.

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui