From: "Rémi Bernon" Subject: [PATCH 1/2] gdi32/tests: Add locale-dependent face matching test. Message-Id: <20201123122050.490616-1-rbernon@codeweavers.com> Date: Mon, 23 Nov 2020 13:20:49 +0100 Signed-off-by: Rémi Bernon --- This brings another ~200ms prefix startup time improvement, from ~1.2s to ~1s for "wine cmd /c exit" execution time on average, as well as a ~50ms process startup time improvement, from ~0.25s to ~0.2s execution time when prefix is already started. The test shows that using wcsicmp is incorrect for face name comparison, or at least that we should not rely on the current locale, and perf also reports a high number of CPU cache miss coming from the locale refcounting, which is the main source of improvement here. IIUC RtlDowncaseUnicodeChar also does locale dependent case folding, but I'm not sure to see how it's controlled (it's the system default locale that defines the loaded tables right?), and we should probably check if case matching depends on it. If not, is there any canonical normalized unicode case folding that should be used instead? dlls/gdi32/tests/font.c | 19 ++++++++++++++----- dlls/gdi32/tests/wine_langnames3.sfd | 4 ++-- dlls/gdi32/tests/wine_langnames3.ttf | Bin 2048 -> 2076 bytes 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index d3ec971dce0..3bcbebaf91a 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -7269,12 +7269,21 @@ static void test_lang_names(void) /* either because it's the primary language, or because it's a secondary */ ok( efnd.total == min( 2, i + 1 ), "%d: EnumFontFamiliesExA unexpected count %u.\n", i, efnd.total ); - strcpy( font.lfFaceName, "Wine Lang Cond (fr)" ); - memset( &efnd, 0, sizeof(efnd) ); - EnumFontFamiliesExA( dc, &font, enum_fullname_data_proc, (LPARAM)&efnd, 0 ); + wcscpy( font_w.lfFaceName, L"Wine Police d'écriture (fr)" ); + memset( &efnd_w, 0, sizeof(efnd_w) ); + EnumFontFamiliesExW( dc, &font_w, enum_fullname_data_proc_w, (LPARAM)&efnd_w, 0 ); /* as wine_langnames3.sfd does not specify (en) name, (fr) is preferred */ - if (i == 2) ok( efnd.total == 1, "%d: EnumFontFamiliesExA unexpected count %u.\n", i, efnd.total ); - else ok( efnd.total == 0, "%d: EnumFontFamiliesExA unexpected count %u.\n", i, efnd.total ); + if (i == 2) ok( efnd_w.total == 1, "%d: EnumFontFamiliesExW unexpected count %u.\n", i, efnd_w.total ); + else ok( efnd_w.total == 0, "%d: EnumFontFamiliesExW unexpected count %u.\n", i, efnd_w.total ); + + /* case matching should not depend on the current locale */ + if (i == 2) + { + wcscpy( font_w.lfFaceName, L"Wine POLICE D'ÉCRITURE (fr)" ); + memset( &efnd_w, 0, sizeof(efnd_w) ); + EnumFontFamiliesExW( dc, &font_w, enum_fullname_data_proc_w, (LPARAM)&efnd_w, 0 ); + todo_wine ok( efnd_w.total == 1, "%d: EnumFontFamiliesExW unexpected count %u.\n", i, efnd_w.total ); + } strcpy( font.lfFaceName, "Wine Lang Cond (ko)" ); memset( &efnd, 0, sizeof(efnd) ); diff --git a/dlls/gdi32/tests/wine_langnames3.sfd b/dlls/gdi32/tests/wine_langnames3.sfd index ea0dbff57d9..55536fa58c1 100644 --- a/dlls/gdi32/tests/wine_langnames3.sfd +++ b/dlls/gdi32/tests/wine_langnames3.sfd @@ -39,8 +39,8 @@ MarkAttachClasses: 1 DEI: 91125 LangName: 1036 \ "" \ - "Wine Lang Cond (fr)" \ - "Reg (fr)" \ + "Wine Police d'+AOkA-criture (fr)" \ + "R+AOkA-guli+AOgA-re (fr)" \ "" \ "Wine Lang Cond Reg (fr)" LangName: 1042 \ diff --git a/dlls/gdi32/tests/wine_langnames3.ttf b/dlls/gdi32/tests/wine_langnames3.ttf index dd76bd478bbb2546cfbbb7e9184cc7f602c59303..408d127fb1ef2a1d74977aecfb6d70a4ae03d838 100644 GIT binary patch delta 236 zcmZn=m?JPjOo)R42xQz{T-_K%8AKQu*q=<)uxGq8F(X4`#|$4PxX7<-4C)Lof$SonNC`tJkOqlrFr)!lnm{K70cF#H;vgL_K(d?Pu?aB(09p|&jsO4v delta 192 zcmbOu&>%2DOo;sn0|SGMyNjzEgD8Ut0|Wbsi5m8d2PS4@Xsl=c_lALic@7Z&D9A4^ z`G1eW45(lVP=gi&Baj5*kW;bSHvWiawpU})V_;@rWZ_|8Vh~^ogR)r|^q4ZhY$2d( zHKrL*Hb~6@C>x~a(&kAlx{U0G3