Jump to content

Recommended Posts

Posted

Hiho Community,

I'm currently working on the next release of my program AMT.

Sadly between v12 and the current Beta the startup time increased from ~2500 to ~11500ms.

I've tracked it down to the 282 GUICtrlSetResizing() calls I'm performing in creating the GUI. Commenting those out the startup time is unchanged.

Sooooo... I must have implemented something stupid that triggers the GUICtrlSetResizing() to be dramatically slowed down.

It's not even consistent across the startup sequence, some calls to GUICtrlSetResizing() take 0.009 (normal) and some 30-60ms (slooow).

It's also not related to certain control classes, slow and fast can happen with any class.

What background calls happen in GUICtrlSetResizing(), are certain window messages called? What is GUICtrlSetResizing() actually doing?

A clueless KaFu looking for tips :), thanks.

 

Posted

Yes, tried that in v12 (fast) and and v12.0.1.5 (slow), no change.

I also see that the later in the script the GUICtrlSetResizing() is called, the slower it is, so the amount of already created controls seems to have an impact too, as if GUICtrlSetResizing() suddenly triggers an re-evaluation of all controls positions?

Posted

Each GUICtrlSetResizing() call now posts 13 windows messages, which it did not before.

Note the GUISetState(@SW_HIDE, $hGUI) directly after the GUICreate(). Without that, the messages are not posted. Worked in 3.3.14.5, so something has changed that throws a wrench into the spinning wheel.

I did that because otherwise a GUI can not be moved before it is first shown. Knowing that, I guess I can work around that for now.

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=Beta
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)


Local $hGUI = GUICreate("Example", Default, Default, Default, Default, $WS_OVERLAPPEDWINDOW, $WS_EX_ACCEPTFILES)
GUISetState(@SW_HIDE, $hGUI)

Local $i_Count = 1000
Local $controls[$i_Count]

Local $iTimer = TimerInit()
For $i = 0 To ($i_Count / 4) - 1
    $controls[$i] = GUICtrlCreateLabel("OK", $i * 2, $i * 2, 85, 25)
Next
ConsoleWrite(TimerDiff($iTimer) & @CRLF)

Local $iTimer = TimerInit()
For $i = ($i_Count / 4) To ($i_Count / 2) - 1
    $controls[$i] = GUICtrlCreateButton("OK", $i * 2, $i * 2, 85, 25)
Next
ConsoleWrite(TimerDiff($iTimer) & @CRLF)

Local $iTimer = TimerInit()
For $i = ($i_Count / 2) To ($i_Count / 4) * 3 - 1
    $controls[$i] = GUICtrlCreateEdit("OK", $i * 2, $i * 2, 85, 25)
Next
ConsoleWrite(TimerDiff($iTimer) & @CRLF)

Local $iTimer = TimerInit()
For $i = ($i_Count / 4) * 3 To $i_Count - 1
    $controls[$i] = GUICtrlCreateCheckbox("OK", $i * 2, $i * 2, 85, 25)
Next
ConsoleWrite(TimerDiff($iTimer) & @CRLF)


For $i = 0 To 32768
    GUIRegisterMsg($i, "WM_MESSAGE")
Next
ConsoleWrite("Start" & @CRLF)

Local $iTimer = TimerInit()
For $i = 0 To $i_Count - 1
    GUICtrlSetResizing($controls[$i], $GUI_DOCKVCENTER + $GUI_DOCKHCENTER + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
    ConsoleWrite(@crlf)
Next
ConsoleWrite(TimerDiff($iTimer) & @CRLF)

Exit
GUISetState(@SW_SHOW, $hGUI)


While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd


Func WM_MESSAGE($hWnd, $iMsg, $wParam, $lParam)
    ConsoleWrite("0x" & Hex($iMsg,4) & @TAB & "WM_MESSAGE" & @CRLF)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...