VM2 - String Engine Activated
I've just finished the main conversion from PlayBssic's string engine, with some spectacular results. (if i don't say so myself). Here's the current benchmark results between PB1.61 + PlayBASIC 1.62 running the code bellow.
The test is running on AMD 3000 system. The results are the average time over 200 frames. Each test is 25000 loops, working on75 to 100 Chr strings in most operations. You do the math, that's a tanker load of data !
PB1.61
Quote: "
Assignment = 4.04
Left & Right$ = 69.98
Instring = 182.612
Replace = 6723.07
Total Time = 1403.31 seconds
"
Yes, It took 23 and 1/2 minutes to run this test in PB1.61.. (1403/60 )
PB1.62
Quote: "
Assignment = 7.14
Left & Right$ = 17.27
Instring = 34.33
Replace = 75.20
Total Time = 27.37 seconds
"
The new engine is a bit slower during direct assignments though. I can probably enhance that, but I think it may well be due to the multi string format design. (IE's that's bit of overhead in a copy now) In other words, we'll loose a little in one area, but gain a lot in others. So it's not an issue worth worrying too much about !
Dim Results#(100)
Max=25000
TestStart=timer()
repeat
cls 0
inc frames
test=1
print "Current Frame:"+str$(frames)
; =====================================================================
ts=timer()
for lp=0 to max
a$="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
b$=a$
next
t=Timer()-ts
Results#(test)=results#(test)+t
Print " String Assignment:"+Str$(results#(test)/frames)
test=test+1
; =====================================================================
ts=timer()
a$="0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
MidChr=len(a$)/2
for lp=0 to max
b$=left$(a$,MidChr)
b$=Right$(a$,MidCHr)
next
t=Timer()-ts
Results#(test)=results#(test)+t
Print " String Left$/RIGHT$:"+Str$(results#(test)/frames)
test=test+1
; =====================================================================
TestString$ ="01234567890123456789012345678901234567890123456789"
TestString$ =TestString$+TestString$+"World"
FindString$ ="World"
ts=timer()
for lp=0 to max
Pos=Instring(TEststring$,FIndString$,0,false)
Pos=Instring(TEststring$,FIndString$,0,true)
next
t=Timer()-ts
Results#(test)=results#(test)+t
Print " Instring:"+Str$(results#(test)/frames)
test=test+1
; =====================================================================
; =====================================================================
TestString$="01234567890123456789012345678901234567890123456789"
TestString$=TestString$+TestString$
FindString$="01234"
ReplaceString$="<<<<<<<<<<01234>>>>>>>>>>"
; print TestString$
Lowercase=false
ts=timer()
for lp=0 to max
; Pos=Instring(TEststring$,FIndString$,0,false)
; Pos=Instring(TEststring$,FIndString$,0,true)
Dead1$=Replace$(TestString$,FindString$,ReplaceString$,0,Lowercase,false)
Dead2$=Replace$(TestString$,FindString$,ReplaceString$,0,Lowercase,true)
next
t=Timer()-ts
Results#(test)=results#(test)+t
Print " Replace:"+Str$(results#(test)/frames)
test=test+1
; print str$(len(dead1$))+" "+dead1$
; print str$(len(dead2$))+" "+dead2$
sync
Until Frames>200
Print "Test Complete"
testEnd=Timer()-TestSTart
Print "Seconds:"+Str$((Timer()-TestStart)/1000.0)
Sync
WaitKey
Older Thread on the subject