Opened 2 years ago

Last modified 2 years ago

#3875 closed Bug

GUICtrlSetResizing() performance — at Initial Version

Reported by: KaFu Owned by:
Milestone: 3.3.16.1 Component: AutoIt
Version: 3.3.15.5 Severity: None
Keywords: Cc:

Description

Hiho Team,

maybe you saw my posting in the open help forum about GUICtrlSetResizing() performance.

I've tracked it further down, and it seems that as of 3.3.15.5 the Windows Message pump for a certain Window is engaged on the first call of GUISetState() for that Window.

This degrades the performance of GUICtrlSetResizing() after that call drastically, and the time increase per call is also proportional to the amount of controls.

100 calls in 3.3.14.5 take 0.2ms, in 3.3.15.5 690ms on my computer.

Best Regards

#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)
GUISetState(@SW_LOCK, $hGUI)


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

Local $i_Count = 100
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)
	GUICtrlSetColor(-1, 0x0000ff)
	GUICtrlSetBkColor(-1, 0x0000ff)
	GUICtrlSetCursor(-1, 1)
	GUICtrlSetTip(-1, "tip of my label")
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)


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

Exit



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

Change History (0)

Note: See TracTickets for help on using tickets.