About wineserver and winsock

Bruno Jesus 00cpxxx at gmail.com
Mon May 26 10:10:15 CDT 2014

Hi all, after studying the ws2_32 dll code for some time while looking
for ways to optimize it I started wondering why is the wineserver
required (please don't stop reading yet).

make test takes 45 seconds in my machine while it takes 25 seconds in
a XP VM running on the same machine. The culprit is test_send() [1]
which takes 24 seconds in wine and 1.8 seconds in windows.

This long time is related to the 1 million recv() calls in
test_send(). Each call to recv() has to call wineserver to do a
enable_event(FD_READ) operation, if you comment that line out [2] wine
magically takes 1.7 seconds, just like windows does (obviously
commenting that line generaters other errors related to event

So, in simple words: what if we move all wineserver socket code to a
thread that is started in the ws2_32 DLL. I know this may sound very
silly for the experienced wine developers, maybe some operations are
impossible without the wineserver, maybe there is much more things
affected, but I think it's better to ask and get crushed with
(hopefully) constructive criticism than forget about the idea.

My main objective with this is to speedup the whole implementation and
properly implement the select call (different socket states result in
different checks required) and WSACleanup call (which needs to close
every open socket on last cleanup) and some other get/setsockopt

[1] http://source.winehq.org/git/wine.git/blob/HEAD:/dlls/ws2_32/tests/sock.c#l4200
[2] http://source.winehq.org/git/wine.git/blob/HEAD:/dlls/ws2_32/socket.c#l6684

Best wishes,

More information about the wine-devel mailing list