Code: Select all
EnableExplicit
Global Dim test.i(15000),n.i,r.i,stime.i,etime.i,num.i=15000,Text_0,j.i,Text_1,String_0,Event
OpenWindow(#PB_Any, 40, 40, 225, 90, "SortArray Micro Bench")
Text_0 = TextGadget(#PB_Any, 5, 5, 100, 25, "Wait...")
stime = ElapsedMilliseconds()
For j =1 To num
r= Random(num*10)
test (n) = r
n+1
Next
SortArray(test(), #PB_Sort_Ascending )
For n =0 To num-1
RandomizeArray(test())
SortArray(test(), #PB_Sort_Ascending )
Next
etime = ElapsedMilliseconds()-stime
DisableGadget(Text_0, 1)
Text_1 = TextGadget(#PB_Any, 28, 35, 100, 25, "Milliseconds")
String_0 = StringGadget(#PB_Any, 120, 25, 80, 40, Str (etime))
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
EndSelect
Until Event = #PB_Event_CloseWindow


