Interactive PowerBasic Forum

IT-Consultant: Charles Pegge => OxygenBasic Examples => Topic started by: Frank BrĂ¼bach on June 27, 2024, 01:11:25 PM

Title: String Speed test
Post by: Frank BrĂ¼bach on June 27, 2024, 01:11:25 PM
Hello all..

Made this little String Speed test. Hope its running perfect..

If there are any Things to optimate  or improve the Code please say

' timer example for a speed test with strings
' oxygen, 27-06-2024, by frank bruebach

uses timeutil

'---Variables declaration
dim strMaxCount  as string
strmaxCount = 1e7 '10000000  ''1e7 => 10 million

SYSTEMTIME   amyTime0
SYSTEMTIME   amyTime1

'---Start time
GetSystemTime amyTime0

'---Dimension the array
redim string MyArray(strMaxCount)

dim count as long
strMaxCount += " test string  "

'---Fill the array
for Count = lbound(strMaxCount) to ubound(strMaxCount)
  MyArray(Count) = Count*Count '^2
next

'---End time
GetSystemTime amyTime1

print len(strMaxCount) ' 22
' format() and str() same results

print "total time to fill an EXT array of strings " + strMaxCount + " elements: " + str(TimeLapseMs(amyTime0,amyTime1), "###") + " msecs"

' result 907 msec
wait