Example with gcc and -O3 maximum optimization flag.
Before:
![screen_before](/uploads/d02727ad61da60e320d25e86bd0457ff/screen_before.jpg)
After:
![screen_after](/uploads/bae74909dd904232b2dc8cced7028036/screen_after.jpg)
From: Herman Semenov GermanAizek@yandex.ru
--- dlls/wldap32/init.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/dlls/wldap32/init.c b/dlls/wldap32/init.c index 44fc44ee485..be1b9acd4d1 100644 --- a/dlls/wldap32/init.c +++ b/dlls/wldap32/init.c @@ -124,11 +124,14 @@ static char *join_hostnames( const char *scheme, char **hostnames, ULONG portnum
sprintf( port, ":%lu", portnumber );
+ size_t scheme_len = strlen( scheme ); + size_t port_len = strlen( port ); + for (v = hostnames; *v; v++) { if (!has_ldap_scheme( *v )) { - size += strlen( scheme ); + size += scheme_len; q = *v; } else @@ -138,12 +141,13 @@ static char *join_hostnames( const char *scheme, char **hostnames, ULONG portnum size += strlen( *v );
if (!strchr( q, ':' )) - size += strlen( port ); + size += port_len;
i++; }
- size += (i - 1) * strlen( sep ); + size_t sep_len = strlen( sep ); + size += (i - 1) * sep_len; if (!(res = malloc( size + 1 ))) return NULL;
p = res; @@ -152,13 +156,13 @@ static char *join_hostnames( const char *scheme, char **hostnames, ULONG portnum if (v != hostnames) { strcpy( p, sep ); - p += strlen( sep ); + p += sep_len; }
if (!has_ldap_scheme( *v )) { strcpy( p, scheme ); - p += strlen( scheme ); + p += scheme_len; q = *v; } else @@ -171,7 +175,7 @@ static char *join_hostnames( const char *scheme, char **hostnames, ULONG portnum if (!strchr( q, ':' )) { strcpy( p, port ); - p += strlen( port ); + p += port_len; } } return res;
From: Herman Semenov GermanAizek@yandex.ru
--- tools/winebuild/import.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index 1ca2048284b..13d4855ce89 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -674,6 +674,8 @@ void read_undef_symbols( DLLSPEC *spec, struct strarray files ) if (!(f = popen( cmd, "r" ))) fatal_error( "Cannot execute '%s'\n", cmd );
+ size_t import_func_prefix_len = strlen( import_func_prefix ); + size_t import_ord_prefix_len = strlen( import_ord_prefix ); while (fgets( buffer, sizeof(buffer), f )) { char *p = buffer + strlen(buffer) - 1; @@ -683,10 +685,10 @@ void read_undef_symbols( DLLSPEC *spec, struct strarray files ) while (*p == ' ') p++; if (p[0] == 'U' && p[1] == ' ' && p[2]) p += 2; if (prefix_len && !strncmp( p, name_prefix, prefix_len )) p += prefix_len; - if (!strncmp( p, import_func_prefix, strlen(import_func_prefix) )) - add_undef_import( p + strlen( import_func_prefix ), 0 ); - else if (!strncmp( p, import_ord_prefix, strlen(import_ord_prefix) )) - add_undef_import( p + strlen( import_ord_prefix ), 1 ); + if (!strncmp( p, import_func_prefix, import_func_prefix_len )) + add_undef_import( p + import_func_prefix_len, 0 ); + else if (!strncmp( p, import_ord_prefix, import_ord_prefix_len )) + add_undef_import( p + import_ord_prefix_len, 1 ); else if (use_msvcrt || !find_name( p, stdc_functions )) strarray_add( &undef_symbols, xstrdup( p )); }
From: Herman Semenov GermanAizek@yandex.ru
--- dlls/dwrite/font.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index b34244238a2..565095afef3 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -4066,15 +4066,16 @@ static const WCHAR *facename_remove_regular_term(WCHAR *facenameW, INT len) };
const WCHAR *regular_ptr = NULL, *ptr; + size_t facename_len = wcslen(facenameW); int i = 0;
if (len == -1) - len = wcslen(facenameW); + len = facename_len;
/* remove rightmost regular variant from face name */ while (!regular_ptr && (ptr = regular_patterns[i++])) { - int pattern_len = wcslen(ptr); + size_t pattern_len = wcslen(ptr); WCHAR *src;
if (pattern_len > len) @@ -4086,7 +4087,7 @@ static const WCHAR *facename_remove_regular_term(WCHAR *facenameW, INT len) if (!wcsnicmp(src, ptr, pattern_len)) { memmove(src, src + pattern_len, (len - pattern_len - (src - facenameW) + 1)*sizeof(WCHAR)); - len = wcslen(facenameW); + len = facename_len; regular_ptr = ptr; break; }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147351
Your paranoid android.
=== debian11b (64 bit WoW report) ===
user32: input.c:4305: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 00000000022D00E6, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
This merge request was closed by Alexandre Julliard.
These kind of micro-optimizations are not useful. Please don't do that unless you can demonstrate a difference with a real app.
On Thu Jul 25 23:09:17 2024 +0000, Alexandre Julliard wrote:
These kind of micro-optimizations are not useful. Please don't do that unless you can demonstrate a difference with a real app.
Code does not visually get worse, I thought Wine strives for maximum optimization so that any functions work faster than on Windows NT.