WolfWorld Posted December 15, 2007 Share Posted December 15, 2007 like the topic title said also Global Const $a = 5 while 1 If $a = 5 then ... wend and Global $a = 5 while 1 If $a = 5 then ... wend Which one will go faster ?? any ideas Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
Developers Jos Posted December 15, 2007 Developers Share Posted December 15, 2007 doubt there will be much difference but you could test it yourself .. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
WolfWorld Posted December 15, 2007 Author Share Posted December 15, 2007 (edited) - -* so which one what about Global Const $a = 5 while 1 If stringregexp($a,'5') then ... wend and Global $a = 5 while 1 If stringregexp($a,'5') then ... wend is anyone of it gona be faster ?? Edited December 15, 2007 by athiwatc Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
Developers Jos Posted December 15, 2007 Developers Share Posted December 15, 2007 (edited) deja vue ... Edited December 15, 2007 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
WolfWorld Posted December 15, 2007 Author Share Posted December 15, 2007 - -* testing my pc sux man i got 15.456 one time and 45.4563 one time - -* and 35 one time Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
Developers Jos Posted December 15, 2007 Developers Share Posted December 15, 2007 try something like this to test: Global $a = 5 $t = TimerInit() For $x = 1 to 1000000 If StringRegExp($a, '5') Then EndIf Next ConsoleWrite('@@ (6) :(' & @min & ':' & @sec & ') TimerDiff($t) = ' & TimerDiff($t) & @CRLF);### Debug Console and then Global const $a = 5 $t = TimerInit() For $x = 1 to 1000000 If StringRegExp($a, '5') Then EndIf Next ConsoleWrite('@@ (6) :(' & @min & ':' & @sec & ') TimerDiff($t) = ' & TimerDiff($t) & @CRLF);### Debug Console Run both a couple of times and see if there is a difference. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
algiuxas Posted July 19, 2016 Share Posted July 19, 2016 (edited) I know it was posted in 2007, but if somebody still want to know if script works faster with Const, it may not work faster. Tested on my computer, it may be different in your computer, sorry for this messy script: Global $nct = 0, $yct = 0 Global $number = 63064;Recommended to use 100000 Global Const $numberConst = $number Global $a = $number Global Const $b = $number MsgBox(0,Null,"Please close programs to avoid high CPU/RAM usage."&@CRLF&"Press OK to continue.") sleep(1000) For $i = 0 to 10 $t = Null sleep(100) $t = TimerInit() For $x = 1 to $a If StringRegExp($a, $number) Then EndIf Next $nct += TimerDiff($t) $t = Null sleep(100) $t = TimerInit() For $x = 1 to $b If StringRegExp($b, $numberConst) Then EndIf Next $yct += TimerDiff($t) Next MsgBox(0,Null,"Global Const took "&$yct&"ms"&@CRLF&"Global took "&$nct&"ms" & @CRLF) MsgBox(0,Null,"Differience "&Round($yct/$nct*100,5)&"%" & @CRLF) sleep(2000) Edited August 24, 2016 by algiuxas After switching years ago to Linux, sadly I don't use AutoIt anymore. 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