05-26-2004, 05:14 AM
It all reduces to the same thing:
BASIC's purpose is the principal matter of its speed disadvantages.
Doing all the changes Z!re and Wizard Genius are suggesting, would create another language that is not Basic. So, why bother? Pascal has a syntax very simmilar to Basic's, but it is in a lower level (still over C), so if you can't be bothered to code in C go for Pascal. TP is a great compiler, but its output still can't outperform TC's.
Z!re you keep repeating the boundary checking stuff! We've got it yet, and I think I replied: You can add those optimizations to a BASIC compiler (check PowerBasic 3.5), but still it won't be as fast as C.
True, and PB 35 does it. But still, you can't reach C's speed 'cause C does not perform ANY runtime checks.
Your VB test: how did you quit? If you add a simple "DoEvents" your program can be 100x slower. Anyways, VB is a better compiler than QB, but it still has tons of checking. VB optimizes way more than QB, but it is even in a higher level than QB.
Have I told you to check PB 35?
There are several QB to ANSI C translators. Its purpose is just being able to run BASIC programs compiled in Linux, for example. But mind you: you will never gain much speed 'cause BASIC will keep being BASIC. They still produce C code that does runtime checkings, and rely in a runtime (you may say "well, so let's write one that does not do those checkings, but that comes back to my very point: in that case, BASIC "sense of existence" vanishes: you must get an error, not a crash).
The only thing you are gaining is that most likely the C compiler you use afterwards optimizes many things, but you still won't get the speed of C.
It is simply impossible. If we are talking about a BASIC compiler, of course.
Z!re and WizardGenius are not talking about a BASIC compiler, but about a "insert-name-of-new-language-here" compiler. I find it interesting (I've been creating interpreters and stuff like that since I can remember), but somewhat pointless: you have plenty of languages available that perform quite well. You don't need that. Seriously.
C isn't such a hassle to code in. C'mon, just a ";" after each statement won't kill ya ... And you can always use #define s to convert your C code in a BASIC-alike code.
Btw, try PB 3.5
Try it, try it.
It is like QB but with some low level stuff (bitwise manipulation, BYTE data type, inline assembly and more), and does optimize, plus generates i386 code.
Did I mention it?
Try PB 3.5
Btw, I remember having given it to Relsoft... Did you do something with it?
EDIT: I just remembered... There is something that looks very similar to what Z!re and WizardGenius are suggesting: Moonrock. It is way faster than QB, does less checkings, and produce really tight executables (hello world = 100 bytes more or less). I suggest you to try it. But expect a crash instead a "integer out of range"
BASIC's purpose is the principal matter of its speed disadvantages.
Doing all the changes Z!re and Wizard Genius are suggesting, would create another language that is not Basic. So, why bother? Pascal has a syntax very simmilar to Basic's, but it is in a lower level (still over C), so if you can't be bothered to code in C go for Pascal. TP is a great compiler, but its output still can't outperform TC's.
Z!re you keep repeating the boundary checking stuff! We've got it yet, and I think I replied: You can add those optimizations to a BASIC compiler (check PowerBasic 3.5), but still it won't be as fast as C.
Quote:And if the program only adds error checking to parts that can have errors, then there's really no problem.
True, and PB 35 does it. But still, you can't reach C's speed 'cause C does not perform ANY runtime checks.
Your VB test: how did you quit? If you add a simple "DoEvents" your program can be 100x slower. Anyways, VB is a better compiler than QB, but it still has tons of checking. VB optimizes way more than QB, but it is even in a higher level than QB.
Quote:To me it just seems like: Meh, I don't want to do it, it's impossible!
Have I told you to check PB 35?
Quote:The compiler CAN translate the "QB" code to whatever you want.
You could write a translator that makes it C code, and then compiles it.
You CAN, do it... Well, someone can, I can't as I don't know enough ASM nor C (damit)
There are several QB to ANSI C translators. Its purpose is just being able to run BASIC programs compiled in Linux, for example. But mind you: you will never gain much speed 'cause BASIC will keep being BASIC. They still produce C code that does runtime checkings, and rely in a runtime (you may say "well, so let's write one that does not do those checkings, but that comes back to my very point: in that case, BASIC "sense of existence" vanishes: you must get an error, not a crash).
The only thing you are gaining is that most likely the C compiler you use afterwards optimizes many things, but you still won't get the speed of C.
It is simply impossible. If we are talking about a BASIC compiler, of course.
Z!re and WizardGenius are not talking about a BASIC compiler, but about a "insert-name-of-new-language-here" compiler. I find it interesting (I've been creating interpreters and stuff like that since I can remember), but somewhat pointless: you have plenty of languages available that perform quite well. You don't need that. Seriously.
C isn't such a hassle to code in. C'mon, just a ";" after each statement won't kill ya ... And you can always use #define s to convert your C code in a BASIC-alike code.
Btw, try PB 3.5
Try it, try it.
It is like QB but with some low level stuff (bitwise manipulation, BYTE data type, inline assembly and more), and does optimize, plus generates i386 code.
Did I mention it?
Try PB 3.5
Btw, I remember having given it to Relsoft... Did you do something with it?
EDIT: I just remembered... There is something that looks very similar to what Z!re and WizardGenius are suggesting: Moonrock. It is way faster than QB, does less checkings, and produce really tight executables (hello world = 100 bytes more or less). I suggest you to try it. But expect a crash instead a "integer out of range"
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i