Code: Select all
;****************************************************************
Procedure.s RandomTextALL(ChisloZnakov)
For x=1 To ChisloZnakov
Select Random(2)
Case 0
Bukva=Random(25)+65
Case 1
Bukva=Random(25)+97
Case 2
Bukva=Random(63)+192
EndSelect
Slovo$=Slovo$+Chr(Bukva)
Next
ProcedureReturn Slovo$
EndProcedure
Procedure PerformanceQuery(TIP)
Static ChastotaSchetchika2.d
Static ZnachenieSchetchikaIN2.d
Select TIP
Case 0
QueryPerformanceFrequency_(@ChastotaSchetchika2.d)
QueryPerformanceCounter_(@ZnachenieSchetchikaIN2.d)
Case 1
QueryPerformanceCounter_(@ZnachenieSchetchikaOUT2.d)
ProshloMikroSekund2=(ZnachenieSchetchikaOUT2-ZnachenieSchetchikaIN2)/ChastotaSchetchika2*1000000
ProcedureReturn ProshloMikroSekund2
EndSelect
EndProcedure
;****************************************************************
#fact=2111111
Dim MyArray1.s (#fact)
Dim MyArray2.s (0)
For x=0 To #fact
; MyArray1(x)=RandomTextALL(10)
MyArray1(x)="999888777333222141144564312"
Next
;****************************************************************
; Result 1
PerformanceQuery(0)
ReDim MyArray2(ArraySize(MyArray1()))
For x=0 To #fact
MyArray2(x)=MyArray1(x)
Next
MS=PerformanceQuery(1)
par1.d=MS
Debug "FOR - NEXT"
Debug Str(MS/1000)+" milliseconds"
Debug Str(MS)+" mikroseund"
Debug "------------------------------------------------"
Debug ""
;****************************************************************
Delay (500)
FreeArray(MyArray2())
Dim MyArray2.s (0)
;****************************************************************
; Result 2
PerformanceQuery(0)
CopyArray(MyArray1(), MyArray2())
MS=PerformanceQuery(1)
par2.d=MS
Debug "CopyArray (...)"
Debug Str(MS/1000)+" milliseconds"
Debug Str(MS)+" mikroseund"
Debug "------------------------------------------------"
Debug ""
;****************************************************************
Debug "on " + StrF(100-(par1*100/par2),1) + " % slower"
;****************************************************************
; For x=0 To #fact/10
; Debug MyArray1(x)
; Debug MyArray2(x)
; Debug "****************"
; Next
;****************************************************************


