As you all know, The BASIC language of ClassPad runs really slow and inefficient. So every person who wants to write good (the best) programs on-calc on ClassPad should use CPLua.
But some programmers have written programs in BASIC, and still some BASIC programs are being written.
I was wondering what's wrong with the cp's internal basic language that runs so slowly? And therefore tried to write my own BASIC interpreter to see how much difference is there in speed! Yes I did that spent 24 hours during the last two weeks to research and develop this addin. I call it 'QBasic' (version 0.1.0).
Already done some benchmarks:
Print 123 Print 123*456 Print "Hey there" Print "ClassPad" (Copy and Paste that 25 times to make 100 lines of code.)Time of running:
CPBASIC: 9 seconds.
QBasic: 4 seconds.
Note that QBasic doesn't have some limitations of CPBASIC, for example in CPBASIC the output window can have max. 30 lines, while QBasic virtually has unlimited number of lines.
1 => a 1+2 => b 12345 => c 123*456 => d (Copy and Paste that 100 times to make 400 lines of code. Then add the following line:) Print "Done."Time of running:
CPBASIC: 1 second.
QBasic: 4 seconds.
QBasic saves variables directly in mcs memory, but I think CPBASIC saves them in ram for a while and detects duplicate variable assignments, which is why QBasic runs slower in this case.
The above expressions are the only things it supports (for now): Print and =>.
Note: You can't have functions in expressions. For example Print sin(x) and sin(30)=>x are not valid (again for now).
It's only a very limited add-in, only a proof of concept. However anyone who likes to try it, download it from here. Type your program in 'Program' application of cp, then go to QBasic and run them via 'Open' menu.
A question is: am i going to develop it more and make a full basic interpreter? I don't know. It depends on people's reactions. Please tell me what do you think about the idea.
Edited by MicroPro, 03 November 2010 - 07:10 PM.