Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

AutoIT Speed Tester


  • Please log in to reply
25 replies to this topic

#21 Shaggi

Shaggi

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 309 posts

Posted 19 March 2012 - 01:07 AM

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







#22 ValeryVal

ValeryVal

    Dig the way

  • Active Members
  • PipPipPipPipPipPip
  • 463 posts

Posted 19 March 2012 - 09:59 AM

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

Like this:
Plain Text         
; 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

#23 Kealper

Kealper

    Wayfarer

  • Active Members
  • Pip
  • 90 posts

Posted 20 March 2012 - 11:17 PM

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

#24 Brobbl

Brobbl

    Seeker

  • Active Members
  • 13 posts

Posted 23 April 2013 - 01:32 PM

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, 23 April 2013 - 01:34 PM.


#25 wraithdu

wraithdu

    this noise inside my head

  • MVPs
  • 2,413 posts

Posted 23 April 2013 - 01:42 PM

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

Edited by wraithdu, 23 April 2013 - 01:43 PM.


#26 Brobbl

Brobbl

    Seeker

  • Active Members
  • 13 posts

Posted 23 April 2013 - 01:55 PM

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, 23 April 2013 - 01:57 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users