AutoIt is quite slow, so I decided to write a new tool which will actually focus on speeding up your AutoIt Scripts up to a factor of 2! The nice side effect is that these scripts will be hard to read for humans too and it is nearly impossible to get the original source code back.
My tool (named Speedfuscator, which means "Speed-Up"+"Obfuscator") comes with a so called "Starter.exe", you can use this GUI to use my tool without cmd but you can also use cmd to use my script everywhere and with every other script by ease. The command line looks like the following:
Where oX means o1, o2 or o3. o1 will speed up your script just a little bit, o2 will speed it up bit more and o3 tries to get the maximum out of your scripts.Quote:
I "Include-Path" S "Script.au3" oX
My Script is doing (at o3) 4 simple steps to speed up your AutoIt scripts:
1. It renames all variable names to as short as possible names (Thats why you should avoid Eval/Assign)
2. It removes all unused functions/variables/Lines
3. It inlines functions to the normal script (this is what brings the real big Speed Up)
4. It extracts all Strings to variables. So at the beginning we have to wait a little bit longer but later on the complete script will be executed faster, this is because of the fact that a variable with name $abc is much shorter than this String: "Please enter your Name: ".
I want to add even more thing to make Speed Up better, but for the moment i will release this version so that all can test and help me finding bugs.
I also provide some Examples (and Example-Times):
As you easily can see Speed-Up gets better the more functions are called and the less complicated they are. So normal Speed-Up will be "only" around 1.1 to 1.2. If you have got some function heavy Scripts it may get up to 1.5 and if you use some "crazy" scripts you may also get factor of 2 (but these scripts are rarely useful in real world).Quote:
Some "real World" examples:
isPrime:
Normal: 8148 ms
After Speeding Up: 7768 msPHP Code:#include<Array.au3>
$prime_count=10000
Local $primes[$prime_count]
$time=TimerInit()
for $i=1 To $prime_count-1
if isPrime($i) Then
$primes[$i]=true
EndIf
Next
ConsoleWrite("Time taken: "&TimerDiff($time)&" ms"&@CRLF)
_ArrayDisplay($primes)
func isPrime($prime)
$end=$prime/2
$start=1
$is_prime=true
While $end>$start
$start+=1
if Mod($prime,$start)==0 Then
$is_prime=false
ExitLoop
EndIf
WEnd
return $is_prime
EndFunc
PHP Code:
$b = "Col "
$c = "Array: ListView Display"
$d = "GUIOnEventMode"
$e = "]"
$f = "|"
$g = "["
$h = ""
$i = "Copy Selected"
$j = "Row "
$k = " ms"
$l = "Time taken: "
$m = "GUIDataSeparatorChar"
$n = 10000
Local $o [ $n ]
$p = TimerInit ( )
for $q = 1 To $n - 1
$r = $q
do
$s = $r / 2
$t = 1
$u = true
While $s > $t
$t += 1
if Mod ( $r , $t ) == 0 Then
$u = false
ExitLoop
EndIf
WEnd
$v = $u
ExitLoop 1
Until 1 == 1
if $v Then
$o [ $q ] = true
EndIf
Next
ConsoleWrite ( $l & TimerDiff ( $p ) & $k & @CRLF )
$w = $o
$x = $c
$y = - 1
$z = 0
$_ = $h
$ab = $f
$bb = $h
do
If Not IsArray ( $w ) Then
$cb = SetError ( 1 , 0 , 0 )
ExitLoop 1
EndIf
Local $db = UBound ( $w , 0 ) , $eb = UBound ( $w , 1 ) - 1 , $fb = UBound ( $w , 2 ) - 1
If $db > 2 Then
$cb = SetError ( 2 , 0 , 0 )
ExitLoop 1
EndIf
If $_ = $h Then $_ = Chr ( 124 )
$gb = $w
$hb = $_
$ib = 0
$jb = 0
$kb = 0
$lb = 1
$mb = 1
$nb = - 1
do
If Not IsArray ( $gb ) Then
$ob = SetError ( 1 , 0 , - 1 )
ExitLoop 1
EndIf
If UBound ( $gb , 0 ) > 2 Or UBound ( $gb , 0 ) < 1 Then
$ob = SetError ( 2 , 0 , - 1 )
ExitLoop 1
EndIf
Local $pb = UBound ( $gb ) - 1
If $jb < 1 Or $jb > $pb Then $jb = $pb
If $ib < 0 Then $ib = 0
If $ib > $jb Then
$ob = SetError ( 4 , 0 , - 1 )
ExitLoop 1
EndIf
Local $qb = 1
If Not $mb Then
Local $rb = $ib
$ib = $jb
$jb = $rb
$qb = - 1
EndIf
Local $sb = False
If $lb = 2 Then
$lb = 0
$sb = True
EndIf
Switch UBound ( $gb , 0 )
Case 1
If Not $lb Then
If Not $kb Then
For $tb = $ib To $jb Step $qb
If $sb And VarGetType ( $gb [ $tb ] ) <> VarGetType ( $hb ) Then ContinueLoop
If $gb [ $tb ] = $hb Then
$ob = $tb
ExitLoop 2
EndIf
Next
Else
For $tb = $ib To $jb Step $qb
If $sb And VarGetType ( $gb [ $tb ] ) <> VarGetType ( $hb ) Then ContinueLoop
If $gb [ $tb ] == $hb Then
$ob = $tb
ExitLoop 2
EndIf
Next
EndIf
Else
For $tb = $ib To $jb Step $qb
If StringInStr ( $gb [ $tb ] , $hb , $kb ) > 0 Then
$ob = $tb
ExitLoop 2
EndIf
Next
EndIf
Case 2
Local $ub = UBound ( $gb , 2 ) - 1
If $nb > $ub Then $nb = $ub
If $nb < 0 Then
$nb = 0
Else
$ub = $nb
EndIf
For $vb = $nb To $ub
If Not $lb Then
If Not $kb Then
For $tb = $ib To $jb Step $qb
If $sb And VarGetType ( $gb [ $tb ] [ $vb ] ) <> VarGetType ( $hb ) Then ContinueLoop
If $gb [ $tb ] [ $vb ] = $hb Then
$ob = $tb
ExitLoop 3
EndIf
Next
Else
For $tb = $ib To $jb Step $qb
If $sb And VarGetType ( $gb [ $tb ] [ $vb ] ) <> VarGetType ( $hb ) Then ContinueLoop
If $gb [ $tb ] [ $vb ] == $hb Then
$ob = $tb
ExitLoop 3
EndIf
Next
EndIf
Else
For $tb = $ib To $jb Step $qb
If StringInStr ( $gb [ $tb ] [ $vb ] , $hb , $kb ) > 0 Then
$ob = $tb
ExitLoop 3
EndIf
Next
EndIf
Next
Case Else
$ob = SetError ( 7 , 0 , - 1 )
ExitLoop 1
EndSwitch
$ob = SetError ( 6 , 0 , - 1 )
ExitLoop 1
Until 1 == 1
$w = $gb
If $ob <> - 1 Then
For $wb = 1 To 255
If $wb >= 32 And $wb <= 127 Then ContinueLoop
$xb = $w
$yb = Chr ( $wb )
$zb = 0
$_b = 0
$ac = 0
$bc = 1
$cc = 1
$dc = - 1
do
If Not IsArray ( $xb ) Then
$ec = SetError ( 1 , 0 , - 1 )
ExitLoop 1
EndIf
If UBound ( $xb , 0 ) > 2 Or UBound ( $xb , 0 ) < 1 Then
$ec = SetError ( 2 , 0 , - 1 )
ExitLoop 1
EndIf
Local $fc = UBound ( $xb ) - 1
If $_b < 1 Or $_b > $fc Then $_b = $fc
If $zb < 0 Then $zb = 0
If $zb > $_b Then
$ec = SetError ( 4 , 0 , - 1 )
ExitLoop 1
EndIf
Local $gc = 1
If Not $cc Then
Local $hc = $zb
$zb = $_b
$_b = $hc
$gc = - 1
EndIf
Local $ic = False
If $bc = 2 Then
$bc = 0
$ic = True
EndIf
Switch UBound ( $xb , 0 )
Case 1
If Not $bc Then
If Not $ac Then
For $jc = $zb To $_b Step $gc
If $ic And VarGetType ( $xb [ $jc ] ) <> VarGetType ( $yb ) Then ContinueLoop
If $xb [ $jc ] = $yb Then
$ec = $jc
ExitLoop 2
EndIf
Next
Else
For $jc = $zb To $_b Step $gc
If $ic And VarGetType ( $xb [ $jc ] ) <> VarGetType ( $yb ) Then ContinueLoop
If $xb [ $jc ] == $yb Then
$ec = $jc
ExitLoop 2
EndIf
Next
EndIf
Else
For $jc = $zb To $_b Step $gc
If StringInStr ( $xb [ $jc ] , $yb , $ac ) > 0 Then
$ec = $jc
ExitLoop 2
EndIf
Next
EndIf
Case 2
Local $kc = UBound ( $xb , 2 ) - 1
If $dc > $kc Then $dc = $kc
If $dc < 0 Then
$dc = 0
Else
$kc = $dc
EndIf
For $lc = $dc To $kc
If Not $bc Then
If Not $ac Then
For $jc = $zb To $_b Step $gc
If $ic And VarGetType ( $xb [ $jc ] [ $lc ] ) <> VarGetType ( $yb ) Then ContinueLoop
If $xb [ $jc ] [ $lc ] = $yb Then
$ec = $jc
ExitLoop 3
EndIf
Next
Else
For $jc = $zb To $_b Step $gc
If $ic And VarGetType ( $xb [ $jc ] [ $lc ] ) <> VarGetType ( $yb ) Then ContinueLoop
If $xb [ $jc ] [ $lc ] == $yb Then
$ec = $jc
ExitLoop 3
EndIf
Next
EndIf
Else
For $jc = $zb To $_b Step $gc
If StringInStr ( $xb [ $jc ] [ $lc ] , $yb , $ac ) > 0 Then
$ec = $jc
ExitLoop 3
EndIf
Next
EndIf
Next
Case Else
$ec = SetError ( 7 , 0 , - 1 )
ExitLoop 1
EndSwitch
$ec = SetError ( 6 , 0 , - 1 )
ExitLoop 1
Until 1 == 1
$w = $xb
Local $mc = $ec
If $mc = - 1 Then
$_ = Chr ( $wb )
ExitLoop
EndIf
Next
EndIf
Local $nc , $oc = 4094
Local $pc = 250
Local $qc = Opt ( $d , 0 ) , $rc = Opt ( $m , $_ )
If $fb < 0 Then $fb = 0
If $z Then
$nc = $eb
$eb = $fb
$fb = $nc
EndIf
If $fb > $pc Then $fb = $pc
If $y < 1 Then $y = $eb
If $eb > $y Then $eb = $y
If $bb = $h Then
$bb = $j
For $sc = 0 To $fb
$bb &= $_ & $b & $sc
Next
EndIf
Local $tc [ $eb + 1 ]
For $sc = 0 To $eb
$tc [ $sc ] = $g & $sc & $e
For $uc = 0 To $fb
If $db = 1 Then
If $z Then
$nc = $w [ $uc ]
Else
$nc = $w [ $sc ]
EndIf
Else
If $z Then
$nc = $w [ $uc ] [ $sc ]
Else
$nc = $w [ $sc ] [ $uc ]
EndIf
EndIf
$nc = StringReplace ( $nc , $_ , $ab , 0 , 1 )
If StringLen ( $nc ) > $oc Then $nc = StringLeft ( $nc , $oc )
$tc [ $sc ] &= $_ & $nc
Next
Next
Local Const $vc = 0x66
Local Const $wc = 0x40
Local Const $xc = 0x0200
Local Const $yc = 0x2
Local Const $zc = 0x4
Local Const $_c = - 3
Local Const $ad = ( 0x1000 + 29 )
Local Const $bd = ( 0x1000 + 4 )
Local Const $cd = ( 0x1000 + 44 )
Local Const $dd = ( 0x1000 + 54 )
Local Const $ed = 0x20
Local Const $fd = 0x1
Local Const $gd = 0x8
Local Const $hd = 0x0200
Local Const $id = 0x00010000
Local Const $jd = 0x00020000
Local Const $kd = 0x00040000
Local $ld = 640 , $md = 480
Local $nd = GUICreate ( $x , $ld , $md , Default , Default , BitOR ( $kd , $jd , $id ) )
Local $od = WinGetClientSize ( $nd )
Local $pd = GUICtrlCreateListView ( $bb , 0 , 0 , $od [ 0 ] , $od [ 1 ] - 26 , $gd )
Local $qd = GUICtrlCreateButton ( $i , 3 , $od [ 1 ] - 23 , $od [ 0 ] - 6 , 20 )
GUICtrlSetResizing ( $pd , $vc )
GUICtrlSetResizing ( $qd , $yc + $zc + $wc + $xc )
GUICtrlSendMsg ( $pd , $dd , $fd , $fd )
GUICtrlSendMsg ( $pd , $dd , $ed , $ed )
GUICtrlSendMsg ( $pd , $dd , $hd , $hd )
For $sc = 0 To $eb
GUICtrlCreateListViewItem ( $tc [ $sc ] , $pd )
Next
$ld = 0
For $sc = 0 To $fb + 1
$ld += GUICtrlSendMsg ( $pd , $ad , $sc , 0 )
Next
If $ld < 250 Then $ld = 230
$ld += 20
If $ld > @DesktopWidth Then $ld = @DesktopWidth - 100
WinMove ( $nd , $h , ( @DesktopWidth - $ld ) / 2 , Default , $ld )
GUISetState ( @SW_SHOW , $nd )
While 1
Switch GUIGetMsg ( )
Case $_c
ExitLoop
Case $qd
Local $rd = $h
Local $sd [ 1 ] = [ 0 ]
For $sc = 0 To GUICtrlSendMsg ( $pd , $bd , 0 , 0 )
If GUICtrlSendMsg ( $pd , $cd , $sc , 0x2 ) Then
$sd [ 0 ] += 1
ReDim $sd [ $sd [ 0 ] + 1 ]
$sd [ $sd [ 0 ] ] = $sc
EndIf
Next
If Not $sd [ 0 ] Then
For $td In $tc
$rd &= $td & @CRLF
Next
Else
For $sc = 1 To UBound ( $sd ) - 1
$rd &= $tc [ $sd [ $sc ] ] & @CRLF
Next
EndIf
ClipPut ( $rd )
EndSwitch
WEnd
GUIDelete ( $nd )
Opt ( $d , $qc )
Opt ( $m , $rc )
$cb = 1
ExitLoop 1
Until 1 == 1
$o = $w
genPassword:
Normal: 4461 ms
After Speeding Up: 4341 msPHP Code:#include<Array.au3>
$password_count=100000
Local $passwords[$password_count]
$time=TimerInit()
for $i=0 To $password_count-1
$passwords[$i]=genPassword()
Next
ConsoleWrite("Time taken: "&TimerDiff($time)&" ms"&@CRLF)
_ArrayDisplay($passwords)
func genPassword()
$pw=""
For $i=0 To 20
$pw&=Chr(Random(64,100,1))
Next
return $pw
EndFunc
PHP Code:
$b = "Col "
$c = "Array: ListView Display"
$d = "GUIOnEventMode"
$e = "]"
$f = "|"
$g = "["
$h = "Row "
$i = " ms"
$j = "Time taken: "
$k = "GUIDataSeparatorChar"
$l = ""
$m = "Copy Selected"
$n = 100000
Local $o [ $n ]
$p = TimerInit ( )
for $q = 0 To $n - 1
do
$r = $l
For $s = 0 To 20
$r &= Chr ( Random ( 64 , 100 , 1 ) )
Next
$t = $r
ExitLoop 1
Until 1 == 1
$o [ $q ] = $t
Next
ConsoleWrite ( $j & TimerDiff ( $p ) & $i & @CRLF )
$u = $o
$v = $c
$w = - 1
$x = 0
$y = $l
$z = $f
$_ = $l
do
If Not IsArray ( $u ) Then
$ab = SetError ( 1 , 0 , 0 )
ExitLoop 1
EndIf
Local $bb = UBound ( $u , 0 ) , $cb = UBound ( $u , 1 ) - 1 , $db = UBound ( $u , 2 ) - 1
If $bb > 2 Then
$ab = SetError ( 2 , 0 , 0 )
ExitLoop 1
EndIf
If $y = $l Then $y = Chr ( 124 )
$eb = $u
$fb = $y
$gb = 0
$hb = 0
$ib = 0
$jb = 1
$kb = 1
$lb = - 1
do
If Not IsArray ( $eb ) Then
$mb = SetError ( 1 , 0 , - 1 )
ExitLoop 1
EndIf
If UBound ( $eb , 0 ) > 2 Or UBound ( $eb , 0 ) < 1 Then
$mb = SetError ( 2 , 0 , - 1 )
ExitLoop 1
EndIf
Local $nb = UBound ( $eb ) - 1
If $hb < 1 Or $hb > $nb Then $hb = $nb
If $gb < 0 Then $gb = 0
If $gb > $hb Then
$mb = SetError ( 4 , 0 , - 1 )
ExitLoop 1
EndIf
Local $ob = 1
If Not $kb Then
Local $pb = $gb
$gb = $hb
$hb = $pb
$ob = - 1
EndIf
Local $qb = False
If $jb = 2 Then
$jb = 0
$qb = True
EndIf
Switch UBound ( $eb , 0 )
Case 1
If Not $jb Then
If Not $ib Then
For $rb = $gb To $hb Step $ob
If $qb And VarGetType ( $eb [ $rb ] ) <> VarGetType ( $fb ) Then ContinueLoop
If $eb [ $rb ] = $fb Then
$mb = $rb
ExitLoop 2
EndIf
Next
Else
For $rb = $gb To $hb Step $ob
If $qb And VarGetType ( $eb [ $rb ] ) <> VarGetType ( $fb ) Then ContinueLoop
If $eb [ $rb ] == $fb Then
$mb = $rb
ExitLoop 2
EndIf
Next
EndIf
Else
For $rb = $gb To $hb Step $ob
If StringInStr ( $eb [ $rb ] , $fb , $ib ) > 0 Then
$mb = $rb
ExitLoop 2
EndIf
Next
EndIf
Case 2
Local $sb = UBound ( $eb , 2 ) - 1
If $lb > $sb Then $lb = $sb
If $lb < 0 Then
$lb = 0
Else
$sb = $lb
EndIf
For $tb = $lb To $sb
If Not $jb Then
If Not $ib Then
For $rb = $gb To $hb Step $ob
If $qb And VarGetType ( $eb [ $rb ] [ $tb ] ) <> VarGetType ( $fb ) Then ContinueLoop
If $eb [ $rb ] [ $tb ] = $fb Then
$mb = $rb
ExitLoop 3
EndIf
Next
Else
For $rb = $gb To $hb Step $ob
If $qb And VarGetType ( $eb [ $rb ] [ $tb ] ) <> VarGetType ( $fb ) Then ContinueLoop
If $eb [ $rb ] [ $tb ] == $fb Then
$mb = $rb
ExitLoop 3
EndIf
Next
EndIf
Else
For $rb = $gb To $hb Step $ob
If StringInStr ( $eb [ $rb ] [ $tb ] , $fb , $ib ) > 0 Then
$mb = $rb
ExitLoop 3
EndIf
Next
EndIf
Next
Case Else
$mb = SetError ( 7 , 0 , - 1 )
ExitLoop 1
EndSwitch
$mb = SetError ( 6 , 0 , - 1 )
ExitLoop 1
Until 1 == 1
$u = $eb
If $mb <> - 1 Then
For $ub = 1 To 255
If $ub >= 32 And $ub <= 127 Then ContinueLoop
$vb = $u
$wb = Chr ( $ub )
$xb = 0
$yb = 0
$zb = 0
$_b = 1
$ac = 1
$bc = - 1
do
If Not IsArray ( $vb ) Then
$cc = SetError ( 1 , 0 , - 1 )
ExitLoop 1
EndIf
If UBound ( $vb , 0 ) > 2 Or UBound ( $vb , 0 ) < 1 Then
$cc = SetError ( 2 , 0 , - 1 )
ExitLoop 1
EndIf
Local $dc = UBound ( $vb ) - 1
If $yb < 1 Or $yb > $dc Then $yb = $dc
If $xb < 0 Then $xb = 0
If $xb > $yb Then
$cc = SetError ( 4 , 0 , - 1 )
ExitLoop 1
EndIf
Local $ec = 1
If Not $ac Then
Local $fc = $xb
$xb = $yb
$yb = $fc
$ec = - 1
EndIf
Local $gc = False
If $_b = 2 Then
$_b = 0
$gc = True
EndIf
Switch UBound ( $vb , 0 )
Case 1
If Not $_b Then
If Not $zb Then
For $hc = $xb To $yb Step $ec
If $gc And VarGetType ( $vb [ $hc ] ) <> VarGetType ( $wb ) Then ContinueLoop
If $vb [ $hc ] = $wb Then
$cc = $hc
ExitLoop 2
EndIf
Next
Else
For $hc = $xb To $yb Step $ec
If $gc And VarGetType ( $vb [ $hc ] ) <> VarGetType ( $wb ) Then ContinueLoop
If $vb [ $hc ] == $wb Then
$cc = $hc
ExitLoop 2
EndIf
Next
EndIf
Else
For $hc = $xb To $yb Step $ec
If StringInStr ( $vb [ $hc ] , $wb , $zb ) > 0 Then
$cc = $hc
ExitLoop 2
EndIf
Next
EndIf
Case 2
Local $ic = UBound ( $vb , 2 ) - 1
If $bc > $ic Then $bc = $ic
If $bc < 0 Then
$bc = 0
Else
$ic = $bc
EndIf
For $jc = $bc To $ic
If Not $_b Then
If Not $zb Then
For $hc = $xb To $yb Step $ec
If $gc And VarGetType ( $vb [ $hc ] [ $jc ] ) <> VarGetType ( $wb ) Then ContinueLoop
If $vb [ $hc ] [ $jc ] = $wb Then
$cc = $hc
ExitLoop 3
EndIf
Next
Else
For $hc = $xb To $yb Step $ec
If $gc And VarGetType ( $vb [ $hc ] [ $jc ] ) <> VarGetType ( $wb ) Then ContinueLoop
If $vb [ $hc ] [ $jc ] == $wb Then
$cc = $hc
ExitLoop 3
EndIf
Next
EndIf
Else
For $hc = $xb To $yb Step $ec
If StringInStr ( $vb [ $hc ] [ $jc ] , $wb , $zb ) > 0 Then
$cc = $hc
ExitLoop 3
EndIf
Next
EndIf
Next
Case Else
$cc = SetError ( 7 , 0 , - 1 )
ExitLoop 1
EndSwitch
$cc = SetError ( 6 , 0 , - 1 )
ExitLoop 1
Until 1 == 1
$u = $vb
Local $kc = $cc
If $kc = - 1 Then
$y = Chr ( $ub )
ExitLoop
EndIf
Next
EndIf
Local $lc , $mc = 4094
Local $nc = 250
Local $oc = Opt ( $d , 0 ) , $pc = Opt ( $k , $y )
If $db < 0 Then $db = 0
If $x Then
$lc = $cb
$cb = $db
$db = $lc
EndIf
If $db > $nc Then $db = $nc
If $w < 1 Then $w = $cb
If $cb > $w Then $cb = $w
If $_ = $l Then
$_ = $h
For $qc = 0 To $db
$_ &= $y & $b & $qc
Next
EndIf
Local $rc [ $cb + 1 ]
For $qc = 0 To $cb
$rc [ $qc ] = $g & $qc & $e
For $sc = 0 To $db
If $bb = 1 Then
If $x Then
$lc = $u [ $sc ]
Else
$lc = $u [ $qc ]
EndIf
Else
If $x Then
$lc = $u [ $sc ] [ $qc ]
Else
$lc = $u [ $qc ] [ $sc ]
EndIf
EndIf
$lc = StringReplace ( $lc , $y , $z , 0 , 1 )
If StringLen ( $lc ) > $mc Then $lc = StringLeft ( $lc , $mc )
$rc [ $qc ] &= $y & $lc
Next
Next
Local Const $tc = 0x66
Local Const $uc = 0x40
Local Const $vc = 0x0200
Local Const $wc = 0x2
Local Const $xc = 0x4
Local Const $yc = - 3
Local Const $zc = ( 0x1000 + 29 )
Local Const $_c = ( 0x1000 + 4 )
Local Const $ad = ( 0x1000 + 44 )
Local Const $bd = ( 0x1000 + 54 )
Local Const $cd = 0x20
Local Const $dd = 0x1
Local Const $ed = 0x8
Local Const $fd = 0x0200
Local Const $gd = 0x00010000
Local Const $hd = 0x00020000
Local Const $id = 0x00040000
Local $jd = 640 , $kd = 480
Local $ld = GUICreate ( $v , $jd , $kd , Default , Default , BitOR ( $id , $hd , $gd ) )
Local $md = WinGetClientSize ( $ld )
Local $nd = GUICtrlCreateListView ( $_ , 0 , 0 , $md [ 0 ] , $md [ 1 ] - 26 , $ed )
Local $od = GUICtrlCreateButton ( $m , 3 , $md [ 1 ] - 23 , $md [ 0 ] - 6 , 20 )
GUICtrlSetResizing ( $nd , $tc )
GUICtrlSetResizing ( $od , $wc + $xc + $uc + $vc )
GUICtrlSendMsg ( $nd , $bd , $dd , $dd )
GUICtrlSendMsg ( $nd , $bd , $cd , $cd )
GUICtrlSendMsg ( $nd , $bd , $fd , $fd )
For $qc = 0 To $cb
GUICtrlCreateListViewItem ( $rc [ $qc ] , $nd )
Next
$jd = 0
For $qc = 0 To $db + 1
$jd += GUICtrlSendMsg ( $nd , $zc , $qc , 0 )
Next
If $jd < 250 Then $jd = 230
$jd += 20
If $jd > @DesktopWidth Then $jd = @DesktopWidth - 100
WinMove ( $ld , $l , ( @DesktopWidth - $jd ) / 2 , Default , $jd )
GUISetState ( @SW_SHOW , $ld )
While 1
Switch GUIGetMsg ( )
Case $yc
ExitLoop
Case $od
Local $pd = $l
Local $qd [ 1 ] = [ 0 ]
For $qc = 0 To GUICtrlSendMsg ( $nd , $_c , 0 , 0 )
If GUICtrlSendMsg ( $nd , $ad , $qc , 0x2 ) Then
$qd [ 0 ] += 1
ReDim $qd [ $qd [ 0 ] + 1 ]
$qd [ $qd [ 0 ] ] = $qc
EndIf
Next
If Not $qd [ 0 ] Then
For $rd In $rc
$pd &= $rd & @CRLF
Next
Else
For $qc = 1 To UBound ( $qd ) - 1
$pd &= $rc [ $qd [ $qc ] ] & @CRLF
Next
EndIf
ClipPut ( $pd )
EndSwitch
WEnd
GUIDelete ( $ld )
Opt ( $d , $oc )
Opt ( $k , $pc )
$ab = 1
ExitLoop 1
Until 1 == 1
$o = $u
If we use Scripts where my Tool can bring up quite a good Speed Up, it may look like that:
calculateDistance:
Normal: 4804 ms
After Speeding Up: 3092 msPHP Code:#include<Array.au3>
$time=TimerInit()
for $i=1 To 1000000
$dist=calculateDistance($i,Cos($i)*15)
Next
ConsoleWrite("Time taken: "&TimerDiff($time)&" ms"&@CRLF)
func calculateDistance($x,$y)
return Sqrt($x^2*$y^2)
EndFunc
PHP Code:
$b = "Time taken: "
$c = " ms"
$d = TimerInit ( )
for $e = 1 To 1000000
$f = $e
$g = Cos ( $e ) * 15
do
$h = Sqrt ( $f ^ 2 * $g ^ 2 )
ExitLoop 1
Until 1 == 1
Next
ConsoleWrite ( $b & TimerDiff ( $d ) & $c & @CRLF )
If you find some problems, just let me know. I will have a look at it.






