https://bugs.winehq.org/show_bug.cgi?id=41379
Bug ID: 41379 Summary: Terrible performance hit for small messages Product: Wine Version: unspecified Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: winsock Assignee: wine-bugs@winehq.org Reporter: Alan.Gibby@dodiis.mil Distribution: ---
I have a simple server and client that both run under Windows and Linux. I am reading small messages (1-byte) in the client that are sent from the server. The client is run under Wine, Linux, and Windows. The client is compiled under Linux with g++ and under Windows with Visual Studio 2010. The client that is run under Wine is about 20 times slower than the client running under Linux or Windows. Could Wine be linking to the wrong version of the system function recv? Turning off the Nagel algorithm with setsockopt makes no difference.
https://bugs.winehq.org/show_bug.cgi?id=41379
--- Comment #1 from Bruno Jesus 00cpxxx@gmail.com --- Are you only using bsd-like funcions? socket, bind, send, recv? No WSA* stuff?
https://bugs.winehq.org/show_bug.cgi?id=41379
--- Comment #2 from Bruno Jesus 00cpxxx@gmail.com --- Created attachment 55727 --> https://bugs.winehq.org/attachment.cgi?id=55727 disable wineserver sync
If the answer to my question is yes you can use this hack to test.
https://bugs.winehq.org/show_bug.cgi?id=41379
--- Comment #3 from Alan.Gibby@dodiis.mil --- The only WSA* call I am making is WSAStartup(MAKEWORD(2,2), &wsdata) for initialization of the Winsock DLL. The socket, bind, listen, setsockopt, connect, accept, send, recv are all vanilla stuff that work on both Linux and Windows.
https://bugs.winehq.org/show_bug.cgi?id=41379
--- Comment #4 from Bruno Jesus 00cpxxx@gmail.com --- That is OK, please test the patch then.
https://bugs.winehq.org/show_bug.cgi?id=41379
Shane drav.85@outlook.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |drav.85@outlook.com
--- Comment #5 from Shane drav.85@outlook.com --- Bruno,
When I put the patch into the source directory and run patch -p1 < wine_patch_55727.diff it replies with the following: patching file dlls/ws2_32/socket.c HUNK #1 FAILED at 7710. 1 out of 1 hunk FAILED -- saving rejects to file dlls/ws2_32/socket.c.rej
Any ideas?
https://bugs.winehq.org/show_bug.cgi?id=41379
--- Comment #6 from Bruno Jesus 00cpxxx@gmail.com --- You are not on wine 1.9.19, just open the file dlls/ws2_32/socket.c and look for the function "static int WS2_recv_base" then in the end of the function you will find:
TRACE(" -> %i bytes\n", n); if (wsa != &localwsa) HeapFree( GetProcessHeap(), 0, wsa ); release_sock_fd( s, fd ); _enable_event(SOCKET2HANDLE(s), FD_READ, 0, 0); SetLastError(ERROR_SUCCESS);
return 0; }
Then just delete or comment the line "_enable_event(SOCKET2HANDLE(s), FD_READ, 0, 0);"
https://bugs.winehq.org/show_bug.cgi?id=41379
--- Comment #7 from Alan.Gibby@dodiis.mil --- The patch improved things dramatically. The wine client is now 3 times slower than it's Windows or Linux counterparts for 1 byte messages, whereas before it was 20-30 times slower.
https://bugs.winehq.org/show_bug.cgi?id=41379
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Terrible performance hit |Receiving multiple 1 byte |for small messages |packets in winsock is | |extremely slow due to | |wineserver round trip to | |enable the FD_READ event Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Keywords| |source, testcase
--- Comment #8 from Bruno Jesus 00cpxxx@gmail.com --- For sake of completeness can you tell your wine version?
This problem is a known issue for a long time but till now nobody ever had a program that worked with such small message lengths so it was never a problem.
The ws2_32/tests can be used to test this since immemorial times.
https://bugs.winehq.org/show_bug.cgi?id=41379
--- Comment #9 from Alan.Gibby@dodiis.mil --- wine1.6.2
https://bugs.winehq.org/show_bug.cgi?id=41379
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |1.6.2