Thanks for the post Brian.
Using this script to read registry data, your script is a little faster on my system.
The CombSort time is: 631 msec
The QS Sort time is: 541 msec
My system has almost 200 software installs on the keys being read into the array.
code:
Break on
$aStart=@ticks
;******************************************
;$software = combsort(getinstalledsoftware)
$software = qs(getinstalledsoftware)
;*******************************************
$aStop=@ticks
? "Running Time is: " $aStop-$aStart
Return
function GetInstalledsoftware
Dim $softwarekey, $index
dim $temparray[10]
$SoftwareKey = enumkey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\",$Index)
while not @error
$DisplayName = readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$SoftwareKey","displayname")
$DisplayVersion = readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$SoftwareKey","DisplayVersion")
if $DisplayName
if $count > ubound($temparray)
redim preserve $temparray[ubound($temparray)+10]
endif
$temparray[$count] = $DisplayName +" "+ $DisplayVersion
$count = $count + 1
endif
$Index = $Index + 1
$SoftwareKey = enumkey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\",$Index)
loop
if $count > 0
redim preserve $temparray[$count-1]
else
$temparray = ""
endif
$getinstalledsoftware = $temparray
endfunction
Function CombSort($v, Optional $o)
Dim $i,$j,$m,$s,$g
$n=UBound($v)
$g = $n
If $g
While $g > 1 Or Not $s
$g=($g*1000)/1279
If $g < 1
$g = 1
EndIf
$s=1
For $i = 0 To $n-$g
$j=$i+$g
If ($v[$i] > $v[$j] And Not $o) Or ($v[$i] < $v[$j] And $o)
$m = $v[$i]
$v[$i] = $v[$j]
$v[$j] = $m
$s=0
EndIf
Next
Loop
$CombSort = $v
Else
$CombSort = 0
EndIf
EndFunction
function qs($a)
DIM $ls[32],$us[32],$sp,$L,$U,$m,$p,$i,$j,$t
$ls[0]=0
$us[0]=UBOUND($a)
$sp=0
While $sp >=0
$l=$ls[$sp]
$u=$us[$sp]
While $L < $U
$p=$L+($U-$L)/2
$t=$a[$L]
$A[$L]=$A[$P]
$A[$P]=$t
$i=$L+1
$j=$U
:L1
While ($i<$j) AND $A[$L] > $A[$i]
$i=$i+1
Loop
While ($j>=$i) AND $A[$j] > $A[$L]
$j=$j-1
Loop
IF $i >= $j goto L2 ENDIF
$t=$A[$i]
$A[$i]=$A[$j]
$A[$j]=$t
$j=$j-1
$i=$i+1
Goto L1
:L2
$t=$a[$l]
$a[$l]=$a[$j]
$a[$j]=$t
$m=$j
If $m-$l <= $u - $m
If $m+1 < $u
$ls[$sp]=$m+1
$us[$sp]=$u
$sp=$sp+1
Endif
$u=$m-1
Else
If $m-1 > $l
$ls[$sp]=$l
$us[$sp]=$m-1
$sp=$sp+1
Endif
$l=$m+1
Endif
Loop
$sp=$sp-1
Loop
$qs=$a
Endfunction