有大神能给我优化一下这段代码吗
For $ss = 0 To UBound($OnlineList) - 1$sRecv = TCPRecv($OnlineList[$ss], 2048, 1)
If $sRecv <> "" Then
$daet = BinaryToString($sRecv, 4)
If StringLeft($daet, 1) = "*" And StringRight($daet, 1) = "*" Then
$SD = StringSplit($daet, "|", 2)
Select
Case $SD = 0 ;查询数据 并返回
$iIndex = _ArraySearch($Verified, 0, 0, 0, 0, 1, 1, 1)
;~ $iIndex = _ArrayFindAll($Verified, 0, 0, 0, 0, 1, 1)
If @error Then
_ArraySort($Verified, 0, 0, 0, 1)
For $si1 = 0 To UBound($Verified) - 1
If $Verified[$si1] > 3 Then
_ArrayDelete($Verified, $si1)
ExitLoop
Else
$Verified[$si1] = 0
EndIf
Next
Else
$Verified[$iIndex] = 1
$sMsg = StringToBinary("*|" & $Verified[$iIndex] & "|" & $Verified[$iIndex] & "|" & $Verified[$iIndex] & "|" & $ver & "|" & $http & "|*", 4)
TCPSend($OnlineList[$ss], $sMsg)
EndIf
Case $SD = 1
;~ $iIndex = _ArrayFindAll($Verified, $SD, 0, 0, 0, 1, 0)
$iIndex = _ArraySearch($Verified, $SD, 0, 0, 0, 1, 1, 0)
If @error Then
Else
$Verified[$iIndex] = $SD
EndIf
Case $SD = 2
$iIndex = _ArraySearch($Verified, $SD, 0, 0, 0, 1, 1, 0)
If @error Then
$all = UBound($Verified) + 1
ReDim $Verified[$all]
$Verified[$all - 1] = $SD
$Verified[$all - 1] = 0
$Verified[$all - 1] = 0
$Verified[$all - 1] = 0
EndIf
Case $SD = 3
If UBound($avArray) > 1 Then
$sMsg = StringToBinary($avArray & "*|" & $avArray & "|0|0|0|0|*", 4)
TCPSend($OnlineList[$ss], $sMsg)
_ArrayDelete($avArray, 0)
Else
If $ll = 0 Then
$ll = 1
$Timer = DllCallbackRegister("_tianjia", "int", "hwnd;uint;uint;dword")
$TimerDLL = DllCall("user32.dll", "uint", "SetTimer", "hwnd", 0, "uint", 0, "int", 10000, "ptr", DllCallbackGetPtr($Timer))
EndIf
EndIf
EndSelect
EndIf
EndIf
Next以前是在数据库读写数据 有最近想把数据读写到数组在操作想着速度应该能快很多 但是测试速度都差不多 请大神看看 这段代码能优化吗 用sqlite去读 回复 2# netegg
您帮我分析一下我这段代码 有写的不合适的地方吗 就这段来看,错是没错,小东西不用太在意所谓的效率问题,用array一样慢,那个也是循环查 回复 4# netegg
用sqlite是不是要比数组快呢 道理上是,不过看你怎么查
页:
[1]