kernel32 & winelib: Don't test string size in CompareStringW for null terminated strings
Adam Strzelecki
ono at java.pl
Fri Feb 29 09:22:30 CST 2008
Hi,
During playing with installing Visual Studio 2005 with WINE I found
out that WINE's MSI is spending lot of time inside lstrcmpW. With Mac
OS X process sampler I checked that actually 60-70% of CompareStringW
is wine_compare_string, rest is rest of function body, which is in
case 2 strlenW calls (inline).
I believe this isn't necessary, moreover most of compares in MSI are
non-matching on first few characters, however with current
implementation we go trough all strings with strlenW regardless of
anything, which is waste in CPU cucles.
I modified both CompareStringW and wine_compare_string so they work
with -1 strings without strlenW checking before.
This saves in my testing about 20-30% of CPU cycles.
Note also that WINE's strlenW and lstrcmpW functions are far from
perfect. Normal msvcrt or glibc string functions are far more
optimized at machine code level. This makes strong impact on WINE
parts strongly relaying on string manipulation which is in this case
MSI.
Cheers,
--
Adam Strzelecki |: nanoant.com :|
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Compare_String_no_width_check.patch
Type: application/octet-stream
Size: 3791 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20080229/6933a530/attachment.obj
More information about the wine-patches
mailing list