+Larry #1 Posted December 4, 2012 I recently completed a significant revision to a series of BASIC programs that I have used to parse a time/date-ordered (very long) text file each month to produce an alphabetical list of movie titles. I end up with a lot less information, but it is in a format that I can quickly use to see if there are some movies I'm interested in watching that month. With my revision, I ended up with just one BASIC program for several different interpreters and compilers. So comparisons are inevitable. Running this program, I ended up with the following times and program sizes -- and also a major question about the Turbo Basic Compiler. First, the times: Atari BASIC...24:35 execution (13 DD sectors) Basic XE...12:14 (no string arrays used) TBXL....9:27 ABC Compiler...6:xx (Integer -- no seconds available)...27 DD sectors TBXL Compiler...4:42...12 DD Sectors + 43 for THE runtime MMG Basic Compiler... 3:xx (Integer -- no seconds available...27 DD sectors (runtime library appended) Most of these times and program sizes (compiler versions) seem pretty logical. I was initially a bit surprised that the MMG compiler version was a bit quicker than the TBXL compiled version, but since TBXL provides floating point, that is likely a big part of the difference. But that leads to a question. I have always heard that the TBXL compiler produces "machine code." Is that really true? Watching the compilers work, it leads me to question it. First, the TBXL compiler is incredibly fast, and *makes only one pass.* Second, the size of the runtime seems very large for a machine code compiler. Compare it to the MMG which does a 3-pass assembly of the source program, and has a very small runtime of (IIRC) typically about a thousand bytes -- similar to the ACTION! runtime. Maybe it's a hybrid of some type? Anyone have some input? Maybe read the original German article or has some other insight? -LARRY 1 Quote Share this post Link to post Share on other sites
+Stephen #2 Posted December 4, 2012 I am pretty sure the TBXL compiler produces what is known as p-code, and then the supplied runtime utilizes it. Quote Share this post Link to post Share on other sites
+Roydea6 #3 Posted December 5, 2012 MMG Basic Compiler... 3:xx (Integer -- no seconds available...27 DD sectors (runtime library appended) I didn't know that this compiler added a runtime library. I thought it was only the ABC compiler that added a runtime. Quote Share this post Link to post Share on other sites
Rybags #4 Posted December 5, 2012 Ideally a compiler would generate a runtime containing only what's needed by each program with it packed and relocated. A large or constant size runtime would be indication that it's not the case. I've not really played about with compilers on/for Atari though, so can't much comment on what optimisations and innovations are out there. For your timing purposes with integer-based languages, you could probably use the OS RTClock variables (dec. 20, 19, 18). Just plug zeroes in at the start, read them at the end and do the maths taking into consideration any limitations the integer maths imposes. Quote Share this post Link to post Share on other sites
+Larry #5 Posted December 5, 2012 Perhaps I should just say "Library" in the case of MMG. But it is equivalent to the library used by Action! As Rybags says, a "smart" compiler just uses what is needed from the pre-written routines available. Essentially macros, I'd say. All three of these compilers have some interesting features. The TBXL Compiler is by far the fastest in actually compiling a Basic program -- about like the Action! compiler. I would also say that it is the most flexible -- it will compile most programs without a lot of changes. ABC and MMG do very well, but you have to be mindful of their requirements. If you write a Basic program with those requirements in mind, no problem. If you pick up a pre-written program from someone else, then you will likely have to make quite a few changes to it in order to get a successful compile. MMG is unique in that it provides an optional assembly language file of your Basic program. That assembly file is occasionally quite useful. @Rybags -- yes, that's how I get the times. But as written, I "do the math" and print the minutes and seconds. I need to print out the "jiffies" as-is. -Larry Quote Share this post Link to post Share on other sites
thorfdbg #6 Posted December 7, 2012 I am pretty sure the TBXL compiler produces what is known as p-code, and then the supplied runtime utilizes it. No, the TBXL compiler really creates machine code. However, in almost all cases, this machine code is just a sequence of "LDA/STA" with "JSR" that go into the runtime library. So it really *is* machine code, though in a sense a pretty high-level one. Quote Share this post Link to post Share on other sites
+Stephen #7 Posted December 7, 2012 Interesting. I have never looked at the output from it before. Quote Share this post Link to post Share on other sites
tschak909 #8 Posted December 8, 2012 It's very much an indirect threaded approach, similar to early FORTH implementations. Action does this to some extent as well, with the standard functions. Quote Share this post Link to post Share on other sites