VM2 Work In Progress - Accelerating Strings
Recently i've been working through expanding the string backend. This is the base layer of code that handles the string data type(s). While it includes some functions, it's mainly just the fundamentals. (typed creation / destroy / addition/ compares/ sizing & conversions).. It's funny how much functionality you just forget about, opps
.. Anyway i'm fleshing & retesting things as I go. So assuming things work ok, they should also be fine when dropped back into the VM.. Some bits may well be a bit faster , but we'll see I guess
..
One of the major changes from VM1, is that VM2 has built in support for three basic string types. "default PB String", "Fixed Length PB Strings" and "Null terminated" (windows styled). Initially I'm focusing on getting the PB default working correctly. I have another type in mind that would great for doing lots of string comparisons, which normally requires a truck load of brute force. But we'll see how we go with that. Can always drop in it later!
Oh dear - Now It's Too Fast
Well, it's the end of the coding day and i just couldn't help testing the speed of some of the new string addition functions. While it's early days, It looking good in this area already !
(Test machine
Duron 800mhz)
PlayBasic VM2 Averages
7 milliseconds
DBpro Averages
19 milliseconds
B+ Averages
30 milliseconds
PlayBasic VM1 Averages
40 milliseconds
DB Averages
61 milliseconds
Print "testing ADD STRING"
a$="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
b$="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
maxtests=5
Print "testing string addition speed"
For tests=0 To maxtests
t=timer()
For lp=0 To 10000
s$=A$+b$
Next
Print s$
Print Timer()-t
Next
sync
waitkey
Cont..
This morning sees the completion of VM2's new string layer. I've spent most of the past day bug fixing and fine tuning the performance of each operation the best I can. That fine tuning is already seeing another *2 improvement in string addition alone (over the previous test above), plus various improvements has been made for string comparisons. While strings comparisons in VM2 are
faster than the competition, there's only marginal improvement (ie. 1 milliseconds over 100,000 tests). But the new design does allow for faster rejection, So in those cases it
can be *2 faster.
Note: This is an old test, VM2 is MUCH faster today