Raik Posted April 5, 2012 Share Posted April 5, 2012 For Your Information: The Loops need different Time to run. If Speed is important, have a Look at this Test. expandcollapse popup$rounds=300000 $txt="AutoIt" For $i=1 To $rounds-1 $txt&=",AutoIt" Next $array=StringSplit($txt,",") ; ------------------------- $begin = TimerInit() For $i=0 To $rounds ; Next $time1 = Round(TimerDiff($begin),2) ; ------------------------- $begin = TimerInit() $i=$rounds While $i ; $i-=1 WEnd $time2 = Round(TimerDiff($begin),2) ; ------------------------- $begin = TimerInit() $i=$rounds Do ; $i-=1 Until Not $i $time3 = Round(TimerDiff($begin),2) ; ------------------------- $begin = TimerInit() $i=$rounds Do ; $i-=1 Until $i=0 $time4 = Round(TimerDiff($begin),2) ; ------------------------- $begin = TimerInit() $i=0 Do ; $i+=1 Until $i=$rounds $time5 = Round(TimerDiff($begin),2) ; ------------------------- $begin = TimerInit() $i=0 While $i<$rounds ; $i+=1 WEnd $time6 = Round(TimerDiff($begin),2) ; ------------------------- $begin = TimerInit() For $i In $array ; Next $time7 = Round(TimerDiff($begin),2) MsgBox(0,"Speedtest","For To:"&@tab&$time1&@CRLF&"While -:"&@tab&$time2&@CRLF&"Until Not:"&@tab&$time3&@CRLF& _ "Until =0:"&@tab&$time4&@CRLF&"Until +:"&@tab&$time5&@CRLF&"While +:"&@tab&$time6&@CRLF&"For In:"&@tab&$time7) "Until" and "While", counting upwards, and "For In" ar slow. The fastest is "For To" in this Test AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1) Link to comment Share on other sites More sharing options...
BrewManNH Posted April 5, 2012 Share Posted April 5, 2012 I'd guess that subtraction is taking an awfully long time to finish by these tests. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Raik Posted April 5, 2012 Author Share Posted April 5, 2012 (edited) Why guessing? try it. and the substracting loops run faster, because they need no comparing ($i to $rounds) but finish by treating 0 as false. Edited April 5, 2012 by Raik AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1) Link to comment Share on other sites More sharing options...
BrewManNH Posted April 5, 2012 Share Posted April 5, 2012 I wasn't guessing, I used this demo and saw the results, "I'm guessing" is a figure of speech, probably doesn't translate that well though. Subtraction takes longer on my computer than adding up does. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Raik Posted April 5, 2012 Author Share Posted April 5, 2012 (edited) Ahh, i'm not a native Speaker. My Results: For To: 25.07 While -: 208.29 Until Not: 278.1 Until =0: 336.88 Until +: 370.97 While +: 398.33 For In: 403.56 Edited April 5, 2012 by Raik AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1) Link to comment Share on other sites More sharing options...
ValeryVal Posted April 6, 2012 Share Posted April 6, 2012 Test this part to dispel mystification about ForTo speed, please: For $i=0 To $rounds $i-=0 Next The point of world view Link to comment Share on other sites More sharing options...
Raik Posted April 6, 2012 Author Share Posted April 6, 2012 You didnt catch the point. This test is not a question of "equity". "$i-=0" is a senseless operation and not necessary for the "For To" loop, while "$i-=1" is necessary for the "while -" loop to run. And btw. even with this sesnseless operation "For To" is the fastest loop on my computer. AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1) Link to comment Share on other sites More sharing options...
rcmaehl Posted April 6, 2012 Share Posted April 6, 2012 Doesn't AutoIt add a 10ms sleep to While loops? My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
BrewManNH Posted April 6, 2012 Share Posted April 6, 2012 It will sleep the script if you're using GUIGetMsg, it doesn't normally sleep a while loop. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
rcmaehl Posted April 6, 2012 Share Posted April 6, 2012 It will sleep the script if you're using GUIGetMsg, it doesn't normally sleep a while loop.Ah, that's what I was thinking of.Anyway, I'm doubting these benchmarks. Each benchmark should be ran in it's own compiled script for more accuracy. My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
BrewManNH Posted April 6, 2012 Share Posted April 6, 2012 Compiling the script shouldn't affect the speed much if at all. A compiled script is just the script and the interpreter stuck together. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
rcmaehl Posted April 6, 2012 Share Posted April 6, 2012 Compiling the script shouldn't affect the speed much if at all. A compiled script is just the script and the interpreter stuck together.It affected the speed greatly in a positive way when running on WINE so I concluded that it should logically be faster when running on normal Windows. Then again, WINE is not an emulator... that would be illegal (I think) My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
BrewManNH Posted April 6, 2012 Share Posted April 6, 2012 I just tested this for myself, compiling a script and running it, and then running AutoIt3.exe and running the script itself, the speeds are about the same. If you run this from SciTe it's slower than running the exe or AutoIt.exe and the script alone. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
rcmaehl Posted April 6, 2012 Share Posted April 6, 2012 I just tested this for myself, compiling a script and running it, and then running AutoIt3.exe and running the script itself, the speeds are about the same. If you run this from SciTe it's slower than running the exe or AutoIt.exe and the script alone.Ah, and WINE probably increased the slowness of running the script from SciTe. My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 6, 2012 Moderators Share Posted April 6, 2012 Hi, I believe the script is tokenised in the "compile" process which could well explain the slight speed increase I see with compiled scripts. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
rcmaehl Posted April 6, 2012 Share Posted April 6, 2012 The Devs probably know best. My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now