I’ve been continuing to experiment with the register-based virtual machine model I told you folks about earlier. Here’s an updated development version of Yabasic: tar.gz, zip. I repeat, it’s a development version. (You’ll get a few compile-time warnings: don’t worry about them, everything will be cleaned up in the end.) Things are coming along nicely; last night and this morning, for instance, I implemented IF statements, FOR loops, INPUT, and several functions. The basics are pretty much done—arrays/structures, subroutines, modules, and a few more complicated functions are all that remain to be completed, really.
I’m really excited about two things. The first is that this version of Yabasic is completely memory-clean: that means there are no memory leaks, and all memory is freed before the interpreter exits. The second is that this version is remarkably fast in comparison to, say, Yabasic 2.763. For example, the following loop:
for a = 1 to 10000000 next
takes 1.5 seconds to execute in Yabasic 2.763 and around 0.4 seconds to execute in this experimental version. That’s a pretty decent increase in speed, if I do say so myself.
In pretty much every other benchmark that I’ve done, this version—with its register-based virtual machine model—has outperformed Yabasic 2.763 substantially, and I think it’s looking very promising.
Here’s a (rather inefficient) program that finds prime numbers:
limit = 10000
for number = 2 to limit
prime = true
for check = 2 to int (sqrt (number))
if not (number mod check) then
prime = false
endif
next
if prime then
print number
endif
next
Have fun, and please report any bugs that you find!
Glad to see that yabasic runs fasrer.