Celeri

AutoIT Speed Tester

27 posts in this topic

#21 ·  Posted

I don't think the OP will be too concerned, he hasn't been online in nearly 3 years, as this is a 5 year old topic brought back from the dead. :bye:

Ah lol, didnt notice :oops:

Ever wanted to call functions in another process? ProcessCall UDFConsole stuff: Console UDFC Preprocessor for AutoIt OMG

Share this post


Link to post
Share on other sites



#22 ·  Posted

But how can we change a While statement like when you want to get gui msg like this one:

Like this:

; A simple custom messagebox that uses the MessageLoop mode
#include <GUIConstantsEx.au3>
_Main()
Func _Main()
Local $YesID, $NoID, $ExitID, $msg
GUICreate("Custom Msgbox", 210, 80)
GUICtrlCreateLabel("Please click a button!", 10, 10)
$YesID = GUICtrlCreateButton("Yes", 10, 50, 50, 20)
$NoID = GUICtrlCreateButton("No", 80, 50, 50, 20)
$ExitID = GUICtrlCreateButton("Exit", 150, 50, 50, 20)
GUISetState() ; display the GUI
for $i = 0 to 0
  $msg = GUIGetMsg()
  Select
   Case $msg = $YesID
    MsgBox(0, "You clicked on", "Yes")
   Case $msg = $NoID
    MsgBox(0, "You clicked on", "No")
   Case $msg = $ExitID
    MsgBox(0, "You clicked on", "Exit")
   Case $msg = $GUI_EVENT_CLOSE
    MsgBox(0, "You clicked on", "Close")
  EndSelect
            if $msg = $GUI_EVENT_CLOSE Or $msg = $ExitID then ExitLoop
            $i -= 1
          next
EndFunc   ;==>_Main

The point of world view

Share this post


Link to post
Share on other sites

#23 ·  Posted

Well it's been so long since this topic was originally started, the timing stuff first mentioned might not even be relevant now... Maybe it was a good thing to dig this up from the grave, since performance issues now might not be the same as performance issues back in 2007 :oops:

Although some of the things mentioned would still apply, since they are dealing with letting more magic happen in the interpreter's internal workings instead of in the code being interpreted... Some things I should mention is with the StringRegExp functions, those now seem about twice as fast as their non-regex counterparts for searching large amounts of text with a simple regex pattern. But as a rule-of-thumb in any interpreted language, if you can get the interpreter to do more work by having your code do less work (like $i += 1 instead of $i = $i + 1) then it'll run faster. (although it isn't going to be that much faster!)


Share this post


Link to post
Share on other sites

#24 ·  Posted (edited)

Hey, just read this and decided to share something interesting about speeding up code.

Also, sorry about bumping this, but i think its (still in 2013) really interesting.

Story / Problem:

I discovered this lately when i was filling a listview of 19 collumns with the > 30,000 entries of my sql data base.

GUICtrlCreateListViewItem("nineteen|collumns|full|of|data", $handle)

If the entry had 'success', 'failure', 'downloaded', etc... in the status collumn, the entry would get colored.

_GUICtrlListView_SetItemColor($handle,$i,0x88ff88) ; green

This process took over 40 minutes on my notebook, so i was looking for a solution to speed up the whole thing.

Solution:

I found this when i was trying to make the GUI more user friendly. I hid and disabled all the controls from the GUI and set the cursor to waiting, both returning to normal when the Listview was finished.

GUISetCursor(15, 1)
GUICtrlSetState($handle, $GUI_DISABLE + $GUI_HIDE)
; ...
_LoadList()
; ...
GUISetCursor(2, 0)
GUICtrlSetState($handle, $GUI_ENABLE + $GUI_SHOW)

After these modifications, the whole process took only 2 minutes, so you can actually increase the performance by 2000% !

TL/DR:

Hiding a Listview control while filling huge amounts of data into it drastically increases performance.

-----

And sorry for my bad english ;)

Edited by Brobbl

Share this post


Link to post
Share on other sites

#25 ·  Posted (edited)

TL/DR:

Hiding a Listview control while filling huge amounts of data into it drastically increases performance.

This is precisely what these are used for (without having to disable or hide the control):

_GUICtrlListView_BeginUpdate()
_GUICtrlListView_EndUpdate()
Edited by wraithdu

Share this post


Link to post
Share on other sites

#26 ·  Posted (edited)

Well I googled a lot about this problem when I expierienced this problem and I didnt find these.

But thank you for your help anyway, looks very nice and may even be worth a change in my code ;)

Edited by Brobbl

Share this post


Link to post
Share on other sites

#27 ·  Posted (edited)

Hi,

Just a small error for calculating the average:

Return $Ave / $i ; Send back the value, dividing total by # of numbers added together --> average

Should be:

Return ($Ave / ($i-1)) ; Send back the value, dividing total by # of numbers added together --> average

Cram...
Edit: I had to edit because I am noob !!!! :-)

Edited by cramaboule
1 person likes this

[font="'Century Gothic';"]My Autoit programs: [/font][font="'Century Gothic';"]MAC Address - - Delete Temp Files[/font][font="'Century Gothic';"] - - Ping Test - - Play Video with VLC full screen dual monitors Set IP - - Pics Converter - - AutoUpdater - - CPU Usage - - Ending Script Nicely - - GDI+ GUI crossfades (slide transitions) - - Beamer - - Search and Search in Files[/font]

[font="'Century Gothic';"]Others:[/font][font="'Microsoft Sans Serif';"][font="'Century Gothic';"]Export Icons into Dll - - My website[/font][/font]

Share this post


Link to post
Share on other sites

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