Modify

Opened 2 years ago

Closed 2 years ago

#3928 closed Bug (Works For Me)

WinWaitActive() prevents Raw Input's WM_INPUT messages from queueing up (drops messages?), resulting in poor responsiveness

Reported by: nurupo Owned by:
Milestone: Component: AutoIt
Version: 3.3.16.0 Severity: None
Keywords: Cc:

Description

Calling into WinWaitActive() somehow results in 1) fewer WM_INPUT messages being delivered and 2) in WM_INPUT messages not queueing up at all.

To illustrate this problem, here is a minimal reproducible example I came up with. I will further explain what it does and how to use it.

#include <AutoItConstants.au3>
#include <WinAPISys.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)
Opt("WinWaitDelay", 0)

Local $hForm = GUICreate("")
Local $tRID = DllStructCreate($tagRAWINPUTDEVICE)
DllStructSetData($tRID, 'UsagePage', 0x01)
DllStructSetData($tRID, 'Usage', 0x02)
DllStructSetData($tRID, 'Flags', $RIDEV_INPUTSINK)
DllStructSetData($tRID, 'hTarget', $hForm)
_WinAPI_RegisterRawInputDevices($tRID)
GUIRegisterMsg($WM_INPUT, 'WM_INPUT')

While 1
    TrayGetMsg()
WEnd

Func WM_INPUT($hWnd, $iMsg, $wParam, $lParam)
    #forceref $iMsg, $wParam
    If $hWnd <> $hForm Then Return
    Local $tRIM = DllStructCreate($tagRAWINPUTMOUSE)
    If Not _WinAPI_GetRawInputData($lParam, $tRIM, DllStructGetSize($tRIM), $RID_INPUT) Then Return
    Local $iFlags = DllStructGetData($tRIM, 'ButtonFlags')
    If BitAND($iFlags, $RI_MOUSE_WHEEL) Then
        OnMouseWheel()
    EndIf
EndFunc

Func OnMouseWheel()
    Local Static $iCount = 0
    Local Static $iSec = @SEC
    If $iSec <> @SEC Then
        ConsoleWrite("Counted " & $iCount & " mouse wheel scrolls in the past second" & @CRLF)
        $iCount = 0
        $iSec = @SEC
    EndIf
    $iCount += 1
    ;LessResponsive()
    ;Local $iDelay = ? ; <-- set to the ms number you get in console when running LessResponsive()
    ;MoreResponsive($iDelay)
EndFunc

Func LessResponsive()
    Local $hWndCurrent = WinGetHandle("[ACTIVE]")
    Local $hWndNotepad = WinActivate("[CLASS:Notepad]")
    Local $hTimer = TimerInit()
    WinWaitActive($hWndNotepad, "", 1)
    Local $iTimerDiff1 = TimerDiff($hTimer)
    ControlSend($hWndNotepad, "", "Edit1", @MSEC & "{Enter}")
    WinActivate($hWndCurrent)
    $hTimer = TimerInit()
    WinWaitActive($hWndCurrent, "", 1)
    Local $iTimerDiff2 = TimerDiff($hTimer)
    ConsoleWrite("LessResponsive: Waited on window for " & ($iTimerDiff1+$iTimerDiff2)/2 & "ms" & @CRLF)
EndFunc

Func MoreResponsive($iDelay)
    Local $hWndCurrent = WinGetHandle("[ACTIVE]")
    Local $hWndNotepad = WinActivate("[CLASS:Notepad]")
    Local $hTimer = TimerInit()
    _WinWaitActive($hWndNotepad, "", 1, $iDelay)
    Local $iTimerDiff1 = TimerDiff($hTimer)
    ControlSend($hWndNotepad, "", "Edit1", @MSEC & "{Enter}")
    WinActivate($hWndCurrent)
    $hTimer = TimerInit()
    _WinWaitActive($hWndCurrent, "", 1, $iDelay)
    Local $iTimerDiff2 = TimerDiff($hTimer)
    ConsoleWrite("MoreResponsive: Waited on window for " & ($iTimerDiff1+$iTimerDiff2)/2 & "ms" & @CRLF)
EndFunc

Func _WinWaitActive($hWnd, $unused, $iTimeout, $iDelay)
    Local $iActiveFlag = Null
    $iTimeout *= 1000
    Local $hTimer = TimerInit()
    Do
        Local $iState = WinGetState($hWnd)
        $iActiveFlag = BitAND($iState, $WIN_STATE_ACTIVE)
    Until $iActiveFlag Or TimerDiff($hTimer) >= $iTimeout
    If $iActiveFlag Then
        _Sleep($iDelay)
    EndIf
    Return $iActiveFlag ? $hWnd : 0
EndFunc

; Seelps in intervals of 1ms for total of $delay ms
Func _Sleep($delay)
    Local $iLeftToSleep = $delay
    Local $hTimer
    If $iLeftToSleep > 1 Then ; sleep in 1ms intervals
        Local Static $hNtdll = DllOpen("ntdll.dll")
        Local Static $hWinmmdll = DllOpen("winmm.dll")
        DllCall($hWinmmdll, "int", "timeBeginPeriod", "int", 1)
        Local $iTimerDiff
        Do
            $hTimer = TimerInit()
            DllCall($hNtdll, "dword", "NtDelayExecution", "int", 0, "int64*", -5000)
            $iTimerDiff = TimerDiff($hTimer)
            $iLeftToSleep -= $iTimerDiff
        Until $iLeftToSleep <= $iTimerDiff
        DllCall($hWinmmdll, "int", "timeEndPeriod", "int", 1)
    EndIf
    ; hot loop for the remaining <= 1ms
    If $iLeftToSleep > 0 Then
        $hTimer = TimerInit()
        Do
        Until TimerDiff($hTimer) >= $iLeftToSleep
    EndIf
EndFunc

What the example above does

The example above expects a Notepad to be running and you focus SciTE window before scrolling the mouse wheel. Whenever you scroll the mouse wheel, OnMouseWheel() gets called, recording how many scrolls you have done during the current second, printing that out to the console on the next second. OnMouseWheel() also calls into LessResponsive() or MoreResponsive(), if one of them is uncommented. They both activate the Notepad window, send some text to it and activate the SciTE window back. The difference is that LessResponsive() uses WinWaitActive(), while MoreResponsive() uses my own imitation version of WinWaitActive() called _WinWaitActive().

---

How to use the example

Firstly, just run it as it is.

  1. Open Notepad, run the script and click on SciTE to make the SciTE window active
  2. Start scrolling the mouse wheel in a consistent manner that is comfortable to you, such that you could reproduce it later
  3. You should see the script activating Notepad back, writing current @MSEC into it, and activating the SciTE window back over and over again
  4. Take a note of how many scrolls per second you do on average by reading out the console output
  5. Terminate the script

(I typically get around 10 scrolls per second)

Now uncomment the LessResponsive() call and redo the same 1-5 steps. Notice how the number of scrolls per second has reduced. For me it went from 10 when LessResponsive() was commented out, to 4 with LessResponsive() uncommented. Take note of the window wait time being printed to the console. (I get around 19ms window wait time).

Now comment out LessResponsive() and uncomment MoreResponsive(). Set $iDelay to the window wait time you got when running LessResponsive(), e.g. I have set mine to 19. Redo steps 1-5 and notice how you get a lot more scrolls per second now. I went from 4 back to 10 as it was before LessResponsive() and MoreResponsive() were uncommented. That's a huge increase in responsiveness! What is more, if you scroll too fast, it will start queueing the unprocessed WM_INPUT messages, i.e. you can stop scrolling and the OnMouseWheel() will continue to get called until all the queued up messages are processed! This didn't happen with LessResponsive(), somehow WinWaitActive() prevented the messages from queueing up.

---

You could say "Why don't you just use your _WinWaitActive() then?". Well, the issue is that while my _WinWaitActive() is a lot more responsive than AutoIt's WinWaitActive(), it's not really comparable in functionality to WinWaitActive(), it's pretty much just a custom Sleep() function that happened to check if a window is in the active state. It doesn't know when a window becomes active the same way WinWaitActive() does. Window's state is always set to active, visible and enabled right after calling WinActivate() on it, so if not for the custom sleep, _WinWaitActive() would have returned right away (under 0.1ms), while WinWaitActive() is somehow able to wait just the right amount of time for the window to get activates, drawn and be ready to receive keyboard input (around 19ms on my computer). As such, _WinWaitActive() is not very usable to me because it doesn't know how long to wait for, and while WinWaitActive() knows for how long to wait for, it's also not very unusable to me but due to it resulting in sluggish message processing and no message queueing. (I assume that WinWaitActivate() knows how long to wait for, it would be funny if it's too just a glorified wrapper for a Sleep() call with an arbitrarily chosen sleep time).

Could you fix WinWaitActive() so that 1) the message processing doesn't become as sluggish and 2) the messages queue properly?

Attachments (0)

Change History (7)

comment:1 Changed 2 years ago by Jpm

Hi,
Thanks for this long ticket with precise information to reproduce.
In fact I don't understand the ...Responsive() function as without them I get best results
In fact some time more than for MoreResponsive()
Cheers

comment:2 Changed 2 years ago by nurupo

While making a reply to you I have noticed a small copy-paste mistake I have made in the How to use the example section, specifically that the step (3) shouldn't be there, as the step (3) only happens when the *Responsive() calls are uncommented.

I ended up improving the reproducible example -- it now does the mouse wheel scrolling for you, making the mouse scrolling more consistent as it no longer depends on a human, no longer mice-specific, etc. The improved example also needs an updated explanation.

Here is the new reproducible example:

#include <AutoItConstants.au3>
#include <WinAPISys.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)
Opt("WinWaitDelay", 0)
Opt("MouseClickDelay", 0)

Local $hForm = GUICreate("")
Local $tRID = DllStructCreate($tagRAWINPUTDEVICE)
DllStructSetData($tRID, 'UsagePage', 0x01)
DllStructSetData($tRID, 'Usage', 0x02)
DllStructSetData($tRID, 'Flags', $RIDEV_INPUTSINK)
DllStructSetData($tRID, 'hTarget', $hForm)
_WinAPI_RegisterRawInputDevices($tRID)
GUIRegisterMsg($WM_INPUT, 'WM_INPUT')

Local Const $SECONDS_TO_SCROLL = 5
Local Const $SCROLLS_PER_SECOND = 5
;Local Const $SCROLLS_PER_SECOND = 50

Global $iReceivedTotal = 0
Global $iReceivedCount = 0

While 1
    AutomatedScrolling()
    TrayGetMsg()
WEnd

Func AutomatedScrolling()
    Local Static $iSec = @SEC
    Local Static $iSecondsCount = 0
    Local Static $iSentTotal = 0
    If $iSec <> @SEC Then
        $iSec = @SEC
        $iSecondsCount += 1
        Local $time = "[" & @HOUR & ":" & @MIN & ":" & @SEC & "]"
        If $iReceivedTotal > 0 Then
            If $iReceivedCount <> 0 Then
                ConsoleWrite("+ " & $time & " Received " & $iReceivedCount & " mouse wheel scroll messages in the past second. Total received/sent: " & $iReceivedTotal & "/" & $iSentTotal & @CRLF)
            Else
                ConsoleWrite("+ " & $time & " Not receiving any more mouse wheel scrolls, so exiting!" & @CRLF)
                Exit
            EndIf
        EndIf
        ; do 5 mouse wheels scrolls every second
        If $iSecondsCount <= $SECONDS_TO_SCROLL Then
            MouseWheel($MOUSE_WHEEL_UP, $SCROLLS_PER_SECOND)
            ConsoleWrite("! " & $time & " Scrolling " & $SCROLLS_PER_SECOND & " times" & @CRLF)
            $iSentTotal += $SCROLLS_PER_SECOND
            If $iSecondsCount = $SECONDS_TO_SCROLL Then
                ConsoleWrite("! " & $time & " Stopped scrolling!" & @CRLF)
            EndIf
        EndIf
        $iReceivedCount = 0
    EndIf
EndFunc

Func WM_INPUT($hWnd, $iMsg, $wParam, $lParam)
    #forceref $iMsg, $wParam
    Local $hTimer = TimerInit()
    If $hWnd <> $hForm Then Return
    Local $tRIM = DllStructCreate($tagRAWINPUTMOUSE)
    If Not _WinAPI_GetRawInputData($lParam, $tRIM, DllStructGetSize($tRIM), $RID_INPUT) Then Return
    Local $iFlags = DllStructGetData($tRIM, 'ButtonFlags')
    If BitAND($iFlags, $RI_MOUSE_WHEEL) Then
        OnMouseWheel()
        ConsoleWrite("OnMouseWheel took " & TimerDiff($hTimer) & "ms" & @CRLF)
    EndIf
EndFunc

Func OnMouseWheel()
    AutomatedScrolling()
    $iReceivedCount += 1
    $iReceivedTotal += 1
    LessResponsive()
    ;Local $iDelay = ? ; <-- set to the ms number you get in console when running LessResponsive()
    ;MoreResponsive($iDelay)
EndFunc

Func LessResponsive()
    Local $hWndCurrent = WinGetHandle("[ACTIVE]")
    Local $hWndNotepad = WinActivate("[CLASS:Notepad]")
    Local $hTimer = TimerInit()
    WinWaitActive($hWndNotepad, "", 1)
    Local $iTimerDiff1 = TimerDiff($hTimer)
    ControlSend($hWndNotepad, "", "Edit1", @MSEC & "{Enter}")
    WinActivate($hWndCurrent)
    $hTimer = TimerInit()
    WinWaitActive($hWndCurrent, "", 1)
    Local $iTimerDiff2 = TimerDiff($hTimer)
    ConsoleWrite("LessResponsive: Waited on a window for an average of " & ($iTimerDiff1+$iTimerDiff2)/2 & "ms" & @CRLF)
EndFunc

Func MoreResponsive($iDelay)
    Local $hWndCurrent = WinGetHandle("[ACTIVE]")
    Local $hWndNotepad = WinActivate("[CLASS:Notepad]")
    Local $hTimer = TimerInit()
    _WinWaitActive($hWndNotepad, "", 1, $iDelay)
    Local $iTimerDiff1 = TimerDiff($hTimer)
    ControlSend($hWndNotepad, "", "Edit1", @MSEC & "{Enter}")
    WinActivate($hWndCurrent)
    $hTimer = TimerInit()
    _WinWaitActive($hWndCurrent, "", 1, $iDelay)
    Local $iTimerDiff2 = TimerDiff($hTimer)
    ConsoleWrite("MoreResponsive: Waited on a window for an average of " & ($iTimerDiff1+$iTimerDiff2)/2 & "ms" & @CRLF)
EndFunc

Func _WinWaitActive($hWnd, $unused, $iTimeout, $iDelay)
    Local $iActiveFlag = Null
    $iTimeout *= 1000
    Local $hTimer = TimerInit()
    Do
        Local $iState = WinGetState($hWnd)
        $iActiveFlag = BitAND($iState, $WIN_STATE_ACTIVE)
    Until $iActiveFlag Or TimerDiff($hTimer) >= $iTimeout
    If $iActiveFlag Then
        _Sleep($iDelay)
    EndIf
    Return $iActiveFlag ? $hWnd : 0
EndFunc

; Seelps in intervals of 1ms for total of $delay ms
Func _Sleep($delay)
    Local $iLeftToSleep = $delay
    Local $hTimer
    If $iLeftToSleep > 1 Then ; sleep in 1ms intervals
        Local Static $hNtdll = DllOpen("ntdll.dll")
        Local Static $hWinmmdll = DllOpen("winmm.dll")
        DllCall($hWinmmdll, "int", "timeBeginPeriod", "int", 1)
        Local $iTimerDiff
        Do
            $hTimer = TimerInit()
            DllCall($hNtdll, "dword", "NtDelayExecution", "int", 0, "int64*", -5000)
            $iTimerDiff = TimerDiff($hTimer)
            $iLeftToSleep -= $iTimerDiff
        Until $iLeftToSleep <= $iTimerDiff
        DllCall($hWinmmdll, "int", "timeEndPeriod", "int", 1)
    EndIf
    ; hot loop for the remaining <= 1ms
    If $iLeftToSleep > 0 Then
        $hTimer = TimerInit()
        Do
        Until TimerDiff($hTimer) >= $iLeftToSleep
    EndIf
EndFunc

How to use the example

LessResponsive()

  1. Open Notepad, run the script and click on SciTE to make the SciTE window active
  2. The script will do 5 mouse wheel scrolls per second for you, for the duration of 5 seconds
  3. You should see the script activating Notepad window, writing current @MSEC into it, and activating the SciTE window back over and over again
  4. After 5 seconds, the script should terminate on its own
  5. Check the console output to see how many scrolls per second the script's message handler received. (In my case it's just 1!)
  6. Take note of the window wait time printed to the console, we will need that for MoreResponsive() later on. (19ms for me, but it's fine if your is different)

Here is what my output for the comparison:

! [14:18:35] Scrolling 5 times
LessResponsive: Waited on a window for an average of 19.3935ms
OnMouseWheel took 79.579ms
+ [14:18:36] Received 1 mouse wheel scroll messages in the past second. Total received/sent: 1/5
! [14:18:36] Scrolling 5 times
LessResponsive: Waited on a window for an average of 19.2935ms
OnMouseWheel took 79.4179ms
+ [14:18:37] Received 1 mouse wheel scroll messages in the past second. Total received/sent: 2/10
! [14:18:37] Scrolling 5 times
LessResponsive: Waited on a window for an average of 18.51545ms
OnMouseWheel took 77.9211ms
+ [14:18:38] Received 1 mouse wheel scroll messages in the past second. Total received/sent: 3/15
! [14:18:38] Scrolling 5 times
LessResponsive: Waited on a window for an average of 18.7937ms
OnMouseWheel took 78.5755ms
+ [14:18:39] Received 1 mouse wheel scroll messages in the past second. Total received/sent: 4/20
! [14:18:39] Scrolling 5 times
! [14:18:39] Stopped scrolling!
LessResponsive: Waited on a window for an average of 18.1046ms
OnMouseWheel took 77.5149ms
+ [14:18:40] Received 1 mouse wheel scroll messages in the past second. Total received/sent: 5/25
+ [14:18:41] Not receiving any more mouse wheel scrolls, so exiting!

Notice that while the scripts sends 5 mouse wheel scroll messages via MouseWheel(), it receives a lot fewer of them per second. On my PC I receive just 1 mouse wheel scroll message per second, i.e. the other 4 of WM_INPUT mouse wheel messages are not being delivered, they are being discarded by AutoIt. The final number I get is 5 messages received when 25 were sent, so 20 messages got discarded in those 5 seconds.

MoreResponsive()

  1. Comment out LessResponsive()
  2. Uncomment MoreResponsive()
  3. Pass into MoreResponsive() the window wait time from the console output you got when running LessResponsive() (e.g. I got 19ms, so I pass 19)
  4. Open Notepad, run the script and click on SciTE to make the SciTE window active
  5. You should see the script activating Notepad window, writing current @MSEC into it, and activating the SciTE window back over and over again
  6. After 5 seconds, the script should terminate on its own
  7. Check the console output to see how many scrolls per second the script's message handler received. (In my case it's 5)

Here is what my output for the comparison:

! [14:39:06] Scrolling 5 times
MoreResponsive: Waited on a window for an average of 19.20735ms
OnMouseWheel took 79.3339ms
MoreResponsive: Waited on a window for an average of 19.1346ms
OnMouseWheel took 78.9798ms
MoreResponsive: Waited on a window for an average of 19.1476ms
OnMouseWheel took 78.965ms
MoreResponsive: Waited on a window for an average of 20.01335ms
OnMouseWheel took 80.7121ms
MoreResponsive: Waited on a window for an average of 19.13965ms
OnMouseWheel took 78.9546ms
+ [14:39:07] Received 5 mouse wheel scroll messages in the past second. Total received/sent: 5/5
! [14:39:07] Scrolling 5 times
MoreResponsive: Waited on a window for an average of 19.16055ms
OnMouseWheel took 79.1232ms
MoreResponsive: Waited on a window for an average of 19.13835ms
OnMouseWheel took 78.8954ms
MoreResponsive: Waited on a window for an average of 19.1325ms
OnMouseWheel took 78.8744ms
MoreResponsive: Waited on a window for an average of 19.1531ms
OnMouseWheel took 78.9944ms
MoreResponsive: Waited on a window for an average of 19.14345ms
OnMouseWheel took 79.1192ms
+ [14:39:08] Received 5 mouse wheel scroll messages in the past second. Total received/sent: 10/10
! [14:39:08] Scrolling 5 times
MoreResponsive: Waited on a window for an average of 19.15265ms
OnMouseWheel took 79.1276ms
MoreResponsive: Waited on a window for an average of 19.14ms
OnMouseWheel took 78.994ms
MoreResponsive: Waited on a window for an average of 19.137ms
OnMouseWheel took 78.8872ms
MoreResponsive: Waited on a window for an average of 19.1426ms
OnMouseWheel took 78.9934ms
MoreResponsive: Waited on a window for an average of 19.1454ms
OnMouseWheel took 79.1021ms
+ [14:39:09] Received 5 mouse wheel scroll messages in the past second. Total received/sent: 15/15
! [14:39:09] Scrolling 5 times
MoreResponsive: Waited on a window for an average of 19.1588ms
OnMouseWheel took 79.1403ms
MoreResponsive: Waited on a window for an average of 19.1328ms
OnMouseWheel took 78.9838ms
MoreResponsive: Waited on a window for an average of 19.1342ms
OnMouseWheel took 78.9359ms
MoreResponsive: Waited on a window for an average of 19.1441ms
OnMouseWheel took 78.9547ms
MoreResponsive: Waited on a window for an average of 19.14125ms
OnMouseWheel took 78.927ms
+ [14:39:10] Received 5 mouse wheel scroll messages in the past second. Total received/sent: 20/20
! [14:39:10] Scrolling 5 times
! [14:39:10] Stopped scrolling!
MoreResponsive: Waited on a window for an average of 19.1734ms
OnMouseWheel took 79.0824ms
MoreResponsive: Waited on a window for an average of 19.131ms
OnMouseWheel took 78.9648ms
MoreResponsive: Waited on a window for an average of 19.1359ms
OnMouseWheel took 78.8764ms
MoreResponsive: Waited on a window for an average of 19.14335ms
OnMouseWheel took 79.1144ms
MoreResponsive: Waited on a window for an average of 19.1393ms
OnMouseWheel took 78.9822ms
+ [14:39:11] Received 5 mouse wheel scroll messages in the past second. Total received/sent: 25/25
+ [14:39:12] Not receiving any more mouse wheel scrolls, so exiting!

Now the script receives a lot more scrolls per second. On my PC I'm getting all 5 of them. That's a huge increase in responsiveness! Also note how by the end of it, all 25 out of 25 mouse scroll messages are received.

Message queueing

What is more, when using MoreResponsive() (or even having all of *Responsive() commented out), if you scroll faster than OnMouseWheel() can keep up with, Autoit will start queueing the unprocessed WM_INPUT messages. You can simulate this by setting $SCROLLS_PER_SECOND to, for example, 50. Because onMouseWheel() takes 79ms to run, the script can process at most 1000/79 = 12.66 mouse wheel scrolls per second, so 50 is definitely faster than OnMouseWheel() can keep up with. You can see that in the case of MoreResponsive(), once the script stops scrolling as indicated by "Stopped scrolling!" in the output, OnMouseWheel() continues to get called until all of the queued up messages are processed, running way beyond the 5 seconds. This doesn't happen with LessResponsive(), somehow WinWaitActive() prevented the messages from queueing up.

LessResponsive()

Here is what my output of LessResponsive() with $SCROLLS_PER_SECOND = 50:

! [14:42:08] Scrolling 50 times
LessResponsive: Waited on a window for an average of 18.82325ms
OnMouseWheel took 78.6073ms
+ [14:42:09] Received 1 mouse wheel scroll messages in the past second. Total received/sent: 1/50
! [14:42:09] Scrolling 50 times
LessResponsive: Waited on a window for an average of 19.0232ms
OnMouseWheel took 78.8683ms
+ [14:42:10] Received 1 mouse wheel scroll messages in the past second. Total received/sent: 2/100
! [14:42:10] Scrolling 50 times
LessResponsive: Waited on a window for an average of 19.68405ms
OnMouseWheel took 80.1286ms
+ [14:42:11] Received 1 mouse wheel scroll messages in the past second. Total received/sent: 3/150
! [14:42:11] Scrolling 50 times
LessResponsive: Waited on a window for an average of 18.36295ms
OnMouseWheel took 77.4988ms
+ [14:42:12] Received 1 mouse wheel scroll messages in the past second. Total received/sent: 4/200
! [14:42:12] Scrolling 50 times
! [14:42:12] Stopped scrolling!
LessResponsive: Waited on a window for an average of 19.47515ms
OnMouseWheel took 79.8082ms
+ [14:42:13] Received 1 mouse wheel scroll messages in the past second. Total received/sent: 5/250
+ [14:42:14] Not receiving any more mouse wheel scrolls, so exiting!

As you can see, it still processes just 1 message per second and doesn't queue anything. By the end, only 5/250 messages were received.

MoreResponsive()

Here is what my output of MoreResponsive() with $SCROLLS_PER_SECOND = 50:

! [14:43:53] Scrolling 50 times
MoreResponsive: Waited on a window for an average of 19.16925ms
OnMouseWheel took 79.1362ms
MoreResponsive: Waited on a window for an average of 19.1368ms
OnMouseWheel took 78.9297ms
MoreResponsive: Waited on a window for an average of 19.1497ms
OnMouseWheel took 78.981ms
MoreResponsive: Waited on a window for an average of 19.137ms
OnMouseWheel took 78.9112ms
MoreResponsive: Waited on a window for an average of 19.1422ms
OnMouseWheel took 78.893ms
MoreResponsive: Waited on a window for an average of 19.13605ms
OnMouseWheel took 78.8913ms
MoreResponsive: Waited on a window for an average of 19.1358ms
OnMouseWheel took 78.9162ms
MoreResponsive: Waited on a window for an average of 19.15145ms
OnMouseWheel took 78.9227ms
MoreResponsive: Waited on a window for an average of 19.13865ms
OnMouseWheel took 78.857ms
MoreResponsive: Waited on a window for an average of 19.14175ms
OnMouseWheel took 78.9469ms
MoreResponsive: Waited on a window for an average of 19.13385ms
OnMouseWheel took 78.8913ms
MoreResponsive: Waited on a window for an average of 19.14025ms
OnMouseWheel took 78.8846ms
MoreResponsive: Waited on a window for an average of 19.1443ms
OnMouseWheel took 78.9492ms
+ [14:43:54] Received 13 mouse wheel scroll messages in the past second. Total received/sent: 13/50
! [14:43:54] Scrolling 50 times
MoreResponsive: Waited on a window for an average of 19.1345ms
OnMouseWheel took 81.5767ms
MoreResponsive: Waited on a window for an average of 19.1441ms
OnMouseWheel took 78.9257ms
MoreResponsive: Waited on a window for an average of 19.14235ms
OnMouseWheel took 78.9533ms
MoreResponsive: Waited on a window for an average of 19.13925ms
OnMouseWheel took 78.9295ms
MoreResponsive: Waited on a window for an average of 19.73405ms
OnMouseWheel took 80.1298ms
MoreResponsive: Waited on a window for an average of 19.13515ms
OnMouseWheel took 78.9028ms
MoreResponsive: Waited on a window for an average of 19.13675ms
OnMouseWheel took 78.8548ms
MoreResponsive: Waited on a window for an average of 19.14135ms
OnMouseWheel took 78.9298ms
MoreResponsive: Waited on a window for an average of 19.144ms
OnMouseWheel took 78.9275ms
MoreResponsive: Waited on a window for an average of 19.1388ms
OnMouseWheel took 78.9479ms
MoreResponsive: Waited on a window for an average of 19.13235ms
OnMouseWheel took 78.9123ms
MoreResponsive: Waited on a window for an average of 19.13785ms
OnMouseWheel took 78.9492ms
MoreResponsive: Waited on a window for an average of 19.1426ms
OnMouseWheel took 78.9539ms
+ [14:43:55] Received 13 mouse wheel scroll messages in the past second. Total received/sent: 26/100
! [14:43:55] Scrolling 50 times
MoreResponsive: Waited on a window for an average of 19.13595ms
OnMouseWheel took 81.5786ms
MoreResponsive: Waited on a window for an average of 19.1373ms
OnMouseWheel took 78.91ms
MoreResponsive: Waited on a window for an average of 19.13325ms
OnMouseWheel took 78.928ms
MoreResponsive: Waited on a window for an average of 19.13645ms
OnMouseWheel took 78.8715ms
MoreResponsive: Waited on a window for an average of 20.44635ms
OnMouseWheel took 81.511ms
MoreResponsive: Waited on a window for an average of 19.1382ms
OnMouseWheel took 78.8956ms
MoreResponsive: Waited on a window for an average of 19.1381ms
OnMouseWheel took 78.9439ms
MoreResponsive: Waited on a window for an average of 19.1413ms
OnMouseWheel took 78.9638ms
MoreResponsive: Waited on a window for an average of 19.13625ms
OnMouseWheel took 78.9304ms
MoreResponsive: Waited on a window for an average of 19.13055ms
OnMouseWheel took 78.9145ms
MoreResponsive: Waited on a window for an average of 19.13615ms
OnMouseWheel took 78.8821ms
MoreResponsive: Waited on a window for an average of 19.13745ms
OnMouseWheel took 78.8846ms
+ [14:43:56] Received 12 mouse wheel scroll messages in the past second. Total received/sent: 38/150
! [14:43:56] Scrolling 50 times
MoreResponsive: Waited on a window for an average of 19.1354ms
OnMouseWheel took 81.542ms
MoreResponsive: Waited on a window for an average of 19.1429ms
OnMouseWheel took 78.8884ms
MoreResponsive: Waited on a window for an average of 19.50675ms
OnMouseWheel took 79.678ms
MoreResponsive: Waited on a window for an average of 19.13165ms
OnMouseWheel took 78.9032ms
MoreResponsive: Waited on a window for an average of 19.1354ms
OnMouseWheel took 78.9053ms
MoreResponsive: Waited on a window for an average of 19.1411ms
OnMouseWheel took 78.8704ms
MoreResponsive: Waited on a window for an average of 19.13805ms
OnMouseWheel took 78.8967ms
MoreResponsive: Waited on a window for an average of 19.13575ms
OnMouseWheel took 78.847ms
MoreResponsive: Waited on a window for an average of 19.13965ms
OnMouseWheel took 78.918ms
MoreResponsive: Waited on a window for an average of 19.15485ms
OnMouseWheel took 78.9932ms
MoreResponsive: Waited on a window for an average of 19.1394ms
OnMouseWheel took 78.9379ms
MoreResponsive: Waited on a window for an average of 19.1385ms
OnMouseWheel took 78.9106ms
MoreResponsive: Waited on a window for an average of 19.1393ms
OnMouseWheel took 78.8636ms
+ [14:43:57] Received 13 mouse wheel scroll messages in the past second. Total received/sent: 51/200
! [14:43:57] Scrolling 50 times
! [14:43:57] Stopped scrolling!
MoreResponsive: Waited on a window for an average of 19.1312ms
OnMouseWheel took 81.778ms
MoreResponsive: Waited on a window for an average of 19.1441ms
OnMouseWheel took 78.9398ms
MoreResponsive: Waited on a window for an average of 19.13685ms
OnMouseWheel took 78.9392ms
MoreResponsive: Waited on a window for an average of 19.1411ms
OnMouseWheel took 78.9531ms
MoreResponsive: Waited on a window for an average of 19.14795ms
OnMouseWheel took 78.9668ms
MoreResponsive: Waited on a window for an average of 19.14245ms
OnMouseWheel took 78.9496ms
MoreResponsive: Waited on a window for an average of 19.13675ms
OnMouseWheel took 78.8968ms
MoreResponsive: Waited on a window for an average of 19.14775ms
OnMouseWheel took 78.9902ms
MoreResponsive: Waited on a window for an average of 20.5754ms
OnMouseWheel took 81.8603ms
MoreResponsive: Waited on a window for an average of 19.1383ms
OnMouseWheel took 78.9006ms
MoreResponsive: Waited on a window for an average of 19.1387ms
OnMouseWheel took 78.8876ms
MoreResponsive: Waited on a window for an average of 19.15295ms
OnMouseWheel took 78.9932ms
+ [14:43:58] Received 12 mouse wheel scroll messages in the past second. Total received/sent: 63/250
MoreResponsive: Waited on a window for an average of 19.1418ms
OnMouseWheel took 78.9843ms
MoreResponsive: Waited on a window for an average of 19.1375ms
OnMouseWheel took 78.9504ms
MoreResponsive: Waited on a window for an average of 19.14925ms
OnMouseWheel took 78.9725ms
MoreResponsive: Waited on a window for an average of 19.13105ms
OnMouseWheel took 78.8872ms
MoreResponsive: Waited on a window for an average of 19.1437ms
OnMouseWheel took 78.9125ms
MoreResponsive: Waited on a window for an average of 19.13725ms
OnMouseWheel took 78.937ms
MoreResponsive: Waited on a window for an average of 19.13015ms
OnMouseWheel took 78.9104ms
MoreResponsive: Waited on a window for an average of 19.14355ms
OnMouseWheel took 79.0331ms
MoreResponsive: Waited on a window for an average of 19.134ms
OnMouseWheel took 78.938ms
MoreResponsive: Waited on a window for an average of 19.13945ms
OnMouseWheel took 78.948ms
MoreResponsive: Waited on a window for an average of 19.6704ms
OnMouseWheel took 79.9834ms
MoreResponsive: Waited on a window for an average of 19.1304ms
OnMouseWheel took 78.853ms
MoreResponsive: Waited on a window for an average of 19.1472ms
OnMouseWheel took 78.8995ms
+ [14:43:59] Received 13 mouse wheel scroll messages in the past second. Total received/sent: 76/250
MoreResponsive: Waited on a window for an average of 19.1387ms
OnMouseWheel took 78.9265ms
MoreResponsive: Waited on a window for an average of 19.1354ms
OnMouseWheel took 78.895ms
MoreResponsive: Waited on a window for an average of 19.1382ms
OnMouseWheel took 78.958ms
MoreResponsive: Waited on a window for an average of 19.1392ms
OnMouseWheel took 78.9764ms
MoreResponsive: Waited on a window for an average of 19.14035ms
OnMouseWheel took 78.958ms
MoreResponsive: Waited on a window for an average of 19.13985ms
OnMouseWheel took 78.9432ms
MoreResponsive: Waited on a window for an average of 19.1392ms
OnMouseWheel took 78.8718ms
MoreResponsive: Waited on a window for an average of 19.13495ms
OnMouseWheel took 78.8664ms
MoreResponsive: Waited on a window for an average of 19.14405ms
OnMouseWheel took 78.9664ms
MoreResponsive: Waited on a window for an average of 19.1345ms
OnMouseWheel took 78.9261ms
MoreResponsive: Waited on a window for an average of 19.14755ms
OnMouseWheel took 78.9492ms
MoreResponsive: Waited on a window for an average of 19.14565ms
OnMouseWheel took 78.9619ms
MoreResponsive: Waited on a window for an average of 19.1394ms
OnMouseWheel took 78.9696ms
+ [14:44:00] Received 13 mouse wheel scroll messages in the past second. Total received/sent: 89/250
MoreResponsive: Waited on a window for an average of 19.13785ms
OnMouseWheel took 78.9097ms
MoreResponsive: Waited on a window for an average of 19.13485ms
OnMouseWheel took 78.9312ms
MoreResponsive: Waited on a window for an average of 19.139ms
OnMouseWheel took 78.9473ms
MoreResponsive: Waited on a window for an average of 19.52245ms
OnMouseWheel took 79.7055ms
MoreResponsive: Waited on a window for an average of 19.14025ms
OnMouseWheel took 78.9317ms
MoreResponsive: Waited on a window for an average of 19.1406ms
OnMouseWheel took 78.9622ms
MoreResponsive: Waited on a window for an average of 19.13855ms
OnMouseWheel took 78.9025ms
MoreResponsive: Waited on a window for an average of 19.1395ms
OnMouseWheel took 78.9202ms
MoreResponsive: Waited on a window for an average of 19.1411ms
OnMouseWheel took 78.8861ms
MoreResponsive: Waited on a window for an average of 19.1396ms
OnMouseWheel took 78.9443ms
MoreResponsive: Waited on a window for an average of 19.14275ms
OnMouseWheel took 78.9078ms
MoreResponsive: Waited on a window for an average of 19.13785ms
OnMouseWheel took 78.8987ms
+ [14:44:01] Received 12 mouse wheel scroll messages in the past second. Total received/sent: 101/250
MoreResponsive: Waited on a window for an average of 19.14185ms
OnMouseWheel took 79.045ms
MoreResponsive: Waited on a window for an average of 19.1483ms
OnMouseWheel took 78.8979ms
MoreResponsive: Waited on a window for an average of 19.13805ms
OnMouseWheel took 78.8659ms
MoreResponsive: Waited on a window for an average of 19.1349ms
OnMouseWheel took 78.8901ms
MoreResponsive: Waited on a window for an average of 19.1351ms
OnMouseWheel took 78.9253ms
MoreResponsive: Waited on a window for an average of 19.1432ms
OnMouseWheel took 78.9413ms
MoreResponsive: Waited on a window for an average of 19.1367ms
OnMouseWheel took 78.9295ms
MoreResponsive: Waited on a window for an average of 19.1358ms
OnMouseWheel took 78.9305ms
MoreResponsive: Waited on a window for an average of 19.12765ms
OnMouseWheel took 78.922ms
MoreResponsive: Waited on a window for an average of 19.12775ms
OnMouseWheel took 78.8435ms
MoreResponsive: Waited on a window for an average of 19.1443ms
OnMouseWheel took 78.8965ms
MoreResponsive: Waited on a window for an average of 19.1464ms
OnMouseWheel took 78.9236ms
MoreResponsive: Waited on a window for an average of 19.14075ms
OnMouseWheel took 78.9333ms
+ [14:44:02] Received 13 mouse wheel scroll messages in the past second. Total received/sent: 114/250
MoreResponsive: Waited on a window for an average of 19.13765ms
OnMouseWheel took 78.9727ms
MoreResponsive: Waited on a window for an average of 19.13935ms
OnMouseWheel took 78.9012ms
MoreResponsive: Waited on a window for an average of 19.1348ms
OnMouseWheel took 78.8682ms
MoreResponsive: Waited on a window for an average of 19.13905ms
OnMouseWheel took 78.9096ms
MoreResponsive: Waited on a window for an average of 19.13685ms
OnMouseWheel took 78.9319ms
MoreResponsive: Waited on a window for an average of 19.14505ms
OnMouseWheel took 78.9067ms
MoreResponsive: Waited on a window for an average of 19.1365ms
OnMouseWheel took 78.9551ms
MoreResponsive: Waited on a window for an average of 19.13885ms
OnMouseWheel took 78.9304ms
MoreResponsive: Waited on a window for an average of 19.1416ms
OnMouseWheel took 78.9218ms
MoreResponsive: Waited on a window for an average of 19.1479ms
OnMouseWheel took 78.9069ms
MoreResponsive: Waited on a window for an average of 19.14185ms
OnMouseWheel took 78.9385ms
MoreResponsive: Waited on a window for an average of 19.14255ms
OnMouseWheel took 78.9482ms
MoreResponsive: Waited on a window for an average of 19.1362ms
OnMouseWheel took 78.9424ms
+ [14:44:03] Received 13 mouse wheel scroll messages in the past second. Total received/sent: 127/250
MoreResponsive: Waited on a window for an average of 20.8112ms
OnMouseWheel took 82.265ms
MoreResponsive: Waited on a window for an average of 19.13925ms
OnMouseWheel took 78.9345ms
MoreResponsive: Waited on a window for an average of 19.1391ms
OnMouseWheel took 78.9314ms
MoreResponsive: Waited on a window for an average of 19.13555ms
OnMouseWheel took 78.9812ms
MoreResponsive: Waited on a window for an average of 19.13905ms
OnMouseWheel took 78.9117ms
MoreResponsive: Waited on a window for an average of 19.1376ms
OnMouseWheel took 78.9231ms
MoreResponsive: Waited on a window for an average of 19.13945ms
OnMouseWheel took 78.8912ms
MoreResponsive: Waited on a window for an average of 19.14045ms
OnMouseWheel took 78.9229ms
MoreResponsive: Waited on a window for an average of 19.1413ms
OnMouseWheel took 78.9644ms
MoreResponsive: Waited on a window for an average of 19.1364ms
OnMouseWheel took 78.9224ms
MoreResponsive: Waited on a window for an average of 19.5011ms
OnMouseWheel took 79.6211ms
MoreResponsive: Waited on a window for an average of 19.1355ms
OnMouseWheel took 78.9209ms
+ [14:44:04] Received 12 mouse wheel scroll messages in the past second. Total received/sent: 139/250
MoreResponsive: Waited on a window for an average of 19.14325ms
OnMouseWheel took 78.9685ms
MoreResponsive: Waited on a window for an average of 21.12125ms
OnMouseWheel took 82.9077ms
MoreResponsive: Waited on a window for an average of 19.1343ms
OnMouseWheel took 78.8633ms
MoreResponsive: Waited on a window for an average of 19.1398ms
OnMouseWheel took 78.8568ms
MoreResponsive: Waited on a window for an average of 19.1361ms
OnMouseWheel took 78.8964ms
MoreResponsive: Waited on a window for an average of 19.137ms
OnMouseWheel took 78.95ms
MoreResponsive: Waited on a window for an average of 19.1409ms
OnMouseWheel took 78.9491ms
MoreResponsive: Waited on a window for an average of 19.14125ms
OnMouseWheel took 78.9458ms
MoreResponsive: Waited on a window for an average of 19.524ms
OnMouseWheel took 79.714ms
MoreResponsive: Waited on a window for an average of 19.13145ms
OnMouseWheel took 78.9199ms
MoreResponsive: Waited on a window for an average of 19.1383ms
OnMouseWheel took 78.9373ms
MoreResponsive: Waited on a window for an average of 19.13455ms
OnMouseWheel took 78.9511ms
MoreResponsive: Waited on a window for an average of 19.13715ms
OnMouseWheel took 78.8925ms
+ [14:44:05] Received 13 mouse wheel scroll messages in the past second. Total received/sent: 152/250
MoreResponsive: Waited on a window for an average of 19.138ms
OnMouseWheel took 78.935ms
MoreResponsive: Waited on a window for an average of 19.13715ms
OnMouseWheel took 78.9106ms
MoreResponsive: Waited on a window for an average of 19.14355ms
OnMouseWheel took 78.9452ms
MoreResponsive: Waited on a window for an average of 19.13665ms
OnMouseWheel took 78.9406ms
MoreResponsive: Waited on a window for an average of 19.13395ms
OnMouseWheel took 78.9552ms
MoreResponsive: Waited on a window for an average of 19.13805ms
OnMouseWheel took 78.8948ms
MoreResponsive: Waited on a window for an average of 19.13945ms
OnMouseWheel took 78.924ms
MoreResponsive: Waited on a window for an average of 19.1413ms
OnMouseWheel took 78.8799ms
MoreResponsive: Waited on a window for an average of 19.14415ms
OnMouseWheel took 78.9406ms
MoreResponsive: Waited on a window for an average of 19.14675ms
OnMouseWheel took 78.9014ms
MoreResponsive: Waited on a window for an average of 19.1407ms
OnMouseWheel took 78.9401ms
MoreResponsive: Waited on a window for an average of 20.6857ms
OnMouseWheel took 82.0345ms
MoreResponsive: Waited on a window for an average of 19.1388ms
OnMouseWheel took 78.9599ms
+ [14:44:06] Received 13 mouse wheel scroll messages in the past second. Total received/sent: 165/250
MoreResponsive: Waited on a window for an average of 19.14075ms
OnMouseWheel took 78.9614ms
MoreResponsive: Waited on a window for an average of 19.13725ms
OnMouseWheel took 78.9325ms
MoreResponsive: Waited on a window for an average of 19.14295ms
OnMouseWheel took 78.8997ms
MoreResponsive: Waited on a window for an average of 19.1547ms
OnMouseWheel took 78.9809ms
MoreResponsive: Waited on a window for an average of 19.1456ms
OnMouseWheel took 78.961ms
MoreResponsive: Waited on a window for an average of 19.1341ms
OnMouseWheel took 78.9506ms
MoreResponsive: Waited on a window for an average of 19.13665ms
OnMouseWheel took 78.8645ms
MoreResponsive: Waited on a window for an average of 19.1414ms
OnMouseWheel took 78.9201ms
MoreResponsive: Waited on a window for an average of 19.14055ms
OnMouseWheel took 78.9343ms
MoreResponsive: Waited on a window for an average of 19.13385ms
OnMouseWheel took 78.9283ms
MoreResponsive: Waited on a window for an average of 19.1333ms
OnMouseWheel took 78.8864ms
MoreResponsive: Waited on a window for an average of 19.13405ms
OnMouseWheel took 78.8866ms
+ [14:44:07] Received 12 mouse wheel scroll messages in the past second. Total received/sent: 177/250
MoreResponsive: Waited on a window for an average of 19.1404ms
OnMouseWheel took 78.919ms
MoreResponsive: Waited on a window for an average of 19.1354ms
OnMouseWheel took 78.887ms
MoreResponsive: Waited on a window for an average of 19.139ms
OnMouseWheel took 78.9116ms
MoreResponsive: Waited on a window for an average of 19.14155ms
OnMouseWheel took 78.9004ms
MoreResponsive: Waited on a window for an average of 19.1336ms
OnMouseWheel took 78.9553ms
MoreResponsive: Waited on a window for an average of 19.14095ms
OnMouseWheel took 78.924ms
MoreResponsive: Waited on a window for an average of 19.14065ms
OnMouseWheel took 78.9251ms
MoreResponsive: Waited on a window for an average of 19.1311ms
OnMouseWheel took 78.8856ms
MoreResponsive: Waited on a window for an average of 19.1375ms
OnMouseWheel took 78.9167ms
MoreResponsive: Waited on a window for an average of 19.13565ms
OnMouseWheel took 78.8719ms
MoreResponsive: Waited on a window for an average of 19.1374ms
OnMouseWheel took 78.942ms
MoreResponsive: Waited on a window for an average of 19.14185ms
OnMouseWheel took 79.1078ms
MoreResponsive: Waited on a window for an average of 19.1382ms
OnMouseWheel took 78.9416ms
+ [14:44:08] Received 13 mouse wheel scroll messages in the past second. Total received/sent: 190/250
MoreResponsive: Waited on a window for an average of 19.1443ms
OnMouseWheel took 78.9494ms
MoreResponsive: Waited on a window for an average of 19.1314ms
OnMouseWheel took 78.938ms
MoreResponsive: Waited on a window for an average of 19.137ms
OnMouseWheel took 78.9198ms
MoreResponsive: Waited on a window for an average of 19.28255ms
OnMouseWheel took 79.2065ms
MoreResponsive: Waited on a window for an average of 19.1399ms
OnMouseWheel took 78.9458ms
MoreResponsive: Waited on a window for an average of 19.1402ms
OnMouseWheel took 78.902ms
MoreResponsive: Waited on a window for an average of 19.14885ms
OnMouseWheel took 78.9614ms
MoreResponsive: Waited on a window for an average of 19.13685ms
OnMouseWheel took 78.9217ms
MoreResponsive: Waited on a window for an average of 19.14075ms
OnMouseWheel took 78.9266ms
MoreResponsive: Waited on a window for an average of 19.1405ms
OnMouseWheel took 78.883ms
MoreResponsive: Waited on a window for an average of 19.1359ms
OnMouseWheel took 78.8836ms
MoreResponsive: Waited on a window for an average of 19.14125ms
OnMouseWheel took 78.8844ms
MoreResponsive: Waited on a window for an average of 19.137ms
OnMouseWheel took 78.8914ms
+ [14:44:09] Received 13 mouse wheel scroll messages in the past second. Total received/sent: 203/250
MoreResponsive: Waited on a window for an average of 19.15305ms
OnMouseWheel took 78.9979ms
MoreResponsive: Waited on a window for an average of 19.1405ms
OnMouseWheel took 78.924ms
MoreResponsive: Waited on a window for an average of 19.138ms
OnMouseWheel took 78.9485ms
MoreResponsive: Waited on a window for an average of 19.13985ms
OnMouseWheel took 78.9512ms
MoreResponsive: Waited on a window for an average of 19.14025ms
OnMouseWheel took 78.8774ms
MoreResponsive: Waited on a window for an average of 19.1448ms
OnMouseWheel took 78.9318ms
MoreResponsive: Waited on a window for an average of 19.1454ms
OnMouseWheel took 78.9595ms
MoreResponsive: Waited on a window for an average of 19.12965ms
OnMouseWheel took 78.8932ms
MoreResponsive: Waited on a window for an average of 19.13235ms
OnMouseWheel took 78.8829ms
MoreResponsive: Waited on a window for an average of 19.57215ms
OnMouseWheel took 79.7519ms
MoreResponsive: Waited on a window for an average of 19.13815ms
OnMouseWheel took 78.8648ms
MoreResponsive: Waited on a window for an average of 19.1379ms
OnMouseWheel took 78.8713ms
+ [14:44:10] Received 12 mouse wheel scroll messages in the past second. Total received/sent: 215/250
MoreResponsive: Waited on a window for an average of 19.13395ms
OnMouseWheel took 79.0023ms
MoreResponsive: Waited on a window for an average of 19.14915ms
OnMouseWheel took 79.0296ms
MoreResponsive: Waited on a window for an average of 19.14165ms
OnMouseWheel took 78.9406ms
MoreResponsive: Waited on a window for an average of 19.1392ms
OnMouseWheel took 78.8606ms
MoreResponsive: Waited on a window for an average of 21.87365ms
OnMouseWheel took 84.3926ms
MoreResponsive: Waited on a window for an average of 19.1341ms
OnMouseWheel took 78.9748ms
MoreResponsive: Waited on a window for an average of 19.14155ms
OnMouseWheel took 78.9551ms
MoreResponsive: Waited on a window for an average of 19.14585ms
OnMouseWheel took 78.9483ms
MoreResponsive: Waited on a window for an average of 19.13535ms
OnMouseWheel took 78.9207ms
MoreResponsive: Waited on a window for an average of 19.14575ms
OnMouseWheel took 78.9077ms
MoreResponsive: Waited on a window for an average of 19.13165ms
OnMouseWheel took 78.9499ms
MoreResponsive: Waited on a window for an average of 19.1295ms
OnMouseWheel took 78.9053ms
MoreResponsive: Waited on a window for an average of 19.1476ms
OnMouseWheel took 78.925ms
+ [14:44:11] Received 13 mouse wheel scroll messages in the past second. Total received/sent: 228/250
MoreResponsive: Waited on a window for an average of 19.1351ms
OnMouseWheel took 78.9391ms
MoreResponsive: Waited on a window for an average of 19.13785ms
OnMouseWheel took 78.9215ms
MoreResponsive: Waited on a window for an average of 19.1411ms
OnMouseWheel took 78.9629ms
MoreResponsive: Waited on a window for an average of 19.1392ms
OnMouseWheel took 78.9237ms
MoreResponsive: Waited on a window for an average of 19.1317ms
OnMouseWheel took 78.8873ms
MoreResponsive: Waited on a window for an average of 19.13845ms
OnMouseWheel took 78.8695ms
MoreResponsive: Waited on a window for an average of 19.137ms
OnMouseWheel took 78.8955ms
MoreResponsive: Waited on a window for an average of 19.1424ms
OnMouseWheel took 78.9553ms
MoreResponsive: Waited on a window for an average of 19.13975ms
OnMouseWheel took 78.8888ms
MoreResponsive: Waited on a window for an average of 19.1408ms
OnMouseWheel took 78.9954ms
MoreResponsive: Waited on a window for an average of 19.1459ms
OnMouseWheel took 78.9083ms
MoreResponsive: Waited on a window for an average of 21.087ms
OnMouseWheel took 82.8467ms
+ [14:44:12] Received 12 mouse wheel scroll messages in the past second. Total received/sent: 240/250
MoreResponsive: Waited on a window for an average of 19.14045ms
OnMouseWheel took 78.9637ms
MoreResponsive: Waited on a window for an average of 19.13635ms
OnMouseWheel took 78.9283ms
MoreResponsive: Waited on a window for an average of 19.14215ms
OnMouseWheel took 78.9371ms
MoreResponsive: Waited on a window for an average of 19.13985ms
OnMouseWheel took 78.9372ms
MoreResponsive: Waited on a window for an average of 19.1386ms
OnMouseWheel took 78.959ms
MoreResponsive: Waited on a window for an average of 19.14095ms
OnMouseWheel took 78.9359ms
MoreResponsive: Waited on a window for an average of 19.59855ms
OnMouseWheel took 79.8775ms
MoreResponsive: Waited on a window for an average of 19.12955ms
OnMouseWheel took 78.8865ms
MoreResponsive: Waited on a window for an average of 19.14495ms
OnMouseWheel took 78.9022ms
MoreResponsive: Waited on a window for an average of 19.1407ms
OnMouseWheel took 78.9513ms
+ [14:44:13] Received 10 mouse wheel scroll messages in the past second. Total received/sent: 250/250
+ [14:44:14] Not receiving any more mouse wheel scrolls, so exiting!

You can see that the script kept receiving mouse scroll messages way after it stopped sending them, it stopped scrolling at 14:43:57 but was still catching up with receding the scroll messages up to 14:44:13, and it only stopped receiving them because all 250 of them were received. The script also took 20 seconds to run, not 5.

So clearly AutoIt is queueing the messages in the case of MoreResponsive(). In fact, AutoIt queues them by default, which you can verify by having both *Reponsive() commented out. But in the case of LessResponsive(), WinWaitActive() somehow breaks the queueing, it breaks the expected default behavior.

---

With all that said, I ask that you look into why WinWaitActive() makes the application less responsive, specifically, why when using it I get 1) fewer WM_INPUT messages being delivered and 2) WM_INPUT messages not queueing up at all, and I hope that this issue gets resolved in some future AutoIt version, if possible.

Sorry for so much text!

comment:3 Changed 2 years ago by AutoXenon

Windows automatically assign message queues for each process/thread. The message stays in the queue/inbox until the program gets around to processing them. Autoit is singlethreaded, it stands to reason that it has to switch between message handling and executing the script, internally we don't know how it splits the processing time other than that the program needs to respond to the window messages in their inbox every so often otherwise the OS will think that it has frozen.

comment:4 Changed 2 years ago by anonymous

Incidentally, the documentation for GUIRegisterMsg states:

Warning: blocking of running user functions which executes window messages with commands such as "MsgBox()" can lead to unexpected behavior, the return to the system should be as fast as possible !!!

comment:5 Changed 2 years ago by nurupo

I guess you are right, I shouldn't be blocking the message handler for so long. I just moved the *Responsive() calls out of the message handler and into the main While 1 loop: made OnMouseWheel() increment a new counter for each event received and the main While 1 loop decrement it, calling LessResponsive() in the While loop instead of the message handler. LessResponsive() no longer causes messages to be dropped and and the messages are now being queued by AutoIt, i.e. the script now behaves similar to how it behaved with MoreResponsive being called inside the message handler.

comment:6 Changed 2 years ago by Jpm

So, if I understand nothing to change, in a simple manner, inside AutoIt code
Cheers

comment:7 Changed 2 years ago by Jpm

  • Resolution set to Works For Me
  • Status changed from new to closed

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.