http://bugs.winehq.org/show_bug.cgi?id=12689
Summary: Input messages lingering in server slowing down wine Product: Wine Version: CVS/GIT Platform: Other OS/Version: other Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: alexd4@inbox.lv
Created an attachment (id=12347) --> (http://bugs.winehq.org/attachment.cgi?id=12347) testcase for problem
Attached testcase illustrates the problem. The problem was originally found in a fan-developed Forsaken mod. I couldn't get feedback on this on wine-devel, so I'm opening a bug for this. Close if it's not a bug or is non-fixable.
How to reproduce: hold a key and move mouse over the window, preferably also clicking mouse buttons, main loop latency steadily increases from 10 to 50 (and even 100) in a short time. In a game this means going from 100 fps to 20 or 10 just because of input messages. Has to be noted that in the actual game the rate of slowdown seemed at least 2-3 times faster when just holding one key and moving mouse, for reasons I don't know, but the testcase still should enough to show the problem.
What the testcase is doing is bad practice, it's basically refusing to process certain types of messages, and PeekMessage just once during a loop is probably bad as well, but that's what the game was originally doing in its main game loop. There are several concerns about it:
1) No slowdown happens on Windows, either in game or in this testcase. No matter how much I move the mouse holding key and clicking madly, it shows same stable 15-16 ticks latency in the testcase. I don't know what it does, but somehow it handles this situation better than Wine.
2) Can this (broken) way of doing things be exposing some inefficiency in message handling, maybe something that could use optimization? I tried to put debug hacks into queue_hardware_message(), it seems that when slowdown is already VERY bad in Forsaken (10fps), message queue in wine server has about 400 or maybe 600 messages. Is that kind of processing overhead per message inevitable? (This is happening on AMD Athlon(tm) 3200+). Perhaps somebody who knows that part of code well may be interested in looking into performance issues in this case. Because, if 400-600 messages in the queue slow down the application to a crawl, then who knows, perhaps it decreases performance of more well-behaved but input-intensive apps as well, just less drastically (holding one or several keys to move, all the while aiming with mouse and abusing mouse buttons is a common thing in games, so there can be quite a few input messages flooding the server).