Jump to content

AutoIT Speed Tester


Celeri
 Share

Recommended Posts

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

Link to comment
Share on other sites

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!)

Link to comment
Share on other sites

  • 1 year later...

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 2 years later...

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
Link to comment
Share on other sites

  • 1 year later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...