]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib3026: drop DLL pre-load perf mitigation for old mingw
authorViktor Szakats <commit@vsz.me>
Thu, 22 May 2025 07:35:25 +0000 (09:35 +0200)
committerViktor Szakats <commit@vsz.me>
Fri, 23 May 2025 09:59:03 +0000 (11:59 +0200)
curl no longer supports old/legacy/classic mingw.

This mitigation was addressing slow perf seen in CI with old mingw.
The slow perf is not seen in current CI with supported compilers.

Remove the duplicate DLL load function from libtest. It's no longer
used after this patch.

Current CI run times for test3026 on GHA/windows:
```
test 3026...[curl_global_init thread-safety]
 # mingw, CM clang-x86_64 gnutls libssh
 -------e--- OK (1715 out of 1738, remaining: 00:02, took 0.196s, duration: 02:55)
 # dl-mingw, CM 9.5.0-x86_64 schannel
 -------e--- OK (1554 out of 1577, remaining: 00:02, took 0.217s, duration: 02:29)
 # msvc, CM x64-windows schannel +examples
 -------e--- OK (1578 out of 1601, remaining: 00:02, took 0.205s, duration: 02:50)
```

Follow-up to 38029101e2d78ba125732b3bab6ec267b80a0e72 #11625
Follow-up to 856b133f5d62475d4cc12624c4cccb4170134712 #9412
Ref: #17413

Closes #17414

tests/libtest/lib3026.c
tests/libtest/testutil.c
tests/libtest/testutil.h

index 93bc512261a0e9bc31d7928d0631d5a04a402734..a94b1a271df2915535b77a7c2d34fd7e5436ec06 100644 (file)
@@ -67,14 +67,6 @@ CURLcode test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  /* On Windows libcurl global init/cleanup calls LoadLibrary/FreeLibrary for
-     secur32.dll and iphlpapi.dll. Here we load them beforehand so that when
-     libcurl calls LoadLibrary/FreeLibrary it only increases/decreases the
-     library's refcount rather than actually loading/unloading the library,
-     which would affect the test runtime. */
-  (void)win32_load_system_library(TEXT("secur32.dll"));
-  (void)win32_load_system_library(TEXT("iphlpapi.dll"));
-
   for(i = 0; i < tid_count; i++) {
     curl_win_thread_handle_t th;
     results[i] = CURL_LAST; /* initialize with invalid value */
index f1745a2b85b57f7e551b792f8e834cac90c511ca..27cb9373afc40a74bedc2ec7828930c8de6e9545 100644 (file)
@@ -129,46 +129,3 @@ double tutil_tvdiff_secs(struct timeval newer, struct timeval older)
       (double)(newer.tv_usec-older.tv_usec)/1000000.0;
   return (double)(newer.tv_usec-older.tv_usec)/1000000.0;
 }
-
-#ifdef _WIN32
-HMODULE win32_load_system_library(const TCHAR *filename)
-{
-#if defined(CURL_WINDOWS_UWP) || defined(UNDER_CE)
-  (void)filename;
-  return NULL;
-#else
-  size_t filenamelen = _tcslen(filename);
-  size_t systemdirlen = GetSystemDirectory(NULL, 0);
-  size_t written;
-  TCHAR *path;
-  HMODULE module;
-
-  if(!filenamelen || filenamelen > 32768 ||
-     !systemdirlen || systemdirlen > 32768)
-    return NULL;
-
-  /* systemdirlen includes null character */
-  path = malloc(sizeof(TCHAR) * (systemdirlen + 1 + filenamelen));
-  if(!path)
-    return NULL;
-
-  /* if written >= systemdirlen then nothing was written */
-  written = GetSystemDirectory(path, (unsigned int)systemdirlen);
-  if(!written || written >= systemdirlen) {
-    free(path);
-    return NULL;
-  }
-
-  if(path[written - 1] != _T('\\'))
-    path[written++] = _T('\\');
-
-  _tcscpy(path + written, filename);
-
-  module = LoadLibrary(path);
-
-  free(path);
-
-  return module;
-#endif
-}
-#endif
index 9f063795aba1251052b47a48195c438a0a0a6535..8696689d9d036098e8c428236ed1a08bd3aeeb1b 100644 (file)
@@ -42,8 +42,4 @@ long tutil_tvdiff(struct timeval t1, struct timeval t2);
  */
 double tutil_tvdiff_secs(struct timeval t1, struct timeval t2);
 
-#ifdef _WIN32
-HMODULE win32_load_system_library(const TCHAR *filename);
-#endif
-
 #endif  /* HEADER_CURL_LIBTEST_TESTUTIL_H */