??? 10/01/06 00:25 Read: times |
#125474 - Perhaps it's a compiler, but how good? Responding to: ???'s previous message |
Back in the days of CP/M, when BASCOM was a Microsoft product for the Z-80, etc, it produced considerably faster code than the same syntax on the same machine using the interpreter, which was also a Microsoft product.
It was supported with a linker and an Assembler, by means of which one could produce libraries of callable functions. The compiled code was MUCH faster than the interpreter, but MUCH slower than what was produced with MT+ Pascal or with BDS C or any of a number of other 'C' compilers. I suspect that this is not so much becuase of the compielr, but because the BASIC language simply doesn't provide the ability to do some things as handily as 'C' will do them. For years now, 'C' has been termed "portable assembler." I doubt that's appropriate, but it's a challenge to write ASM code that's appreciably faster than some 'C' compiler output. The primary difference seems, in most cases, to be that the 'C' compiler output is larger than the ASM output. Now, why would that matter in a case where one has 64KB of code space available? Well, in the context of a discussion of comparing/contrasting the output from BASCOM vs. the output from ASEM51 or the like, perhaps that's because BASIC doesn't provide convenient means for managing code large enough for this to become an issue. It doesn't rule things out, but it doesn't make it convenient to handle them. Does BASCOM produce ASM output files? If not, how do you handle cases where the output has to be faster than it is, i.e. where it has to take exactly 41.37 microseconds from the time you enter this function until you've returned to the calling procedure? In fact, how well can it handle generating critically timed code? If you have to "get around the loop" in 21 machine-code instruction cycles, how can you ensure that in Bascom? After that, how well does it allow you to use two or more data pointers, exploiting features in a controller equipped with them that allow you to move data with one pointer for source and the other with destination address, incrementing or decrementing them automatically? If you have a pointer value that exceeds 32767, as you might if you're comparing values in a table in code space, how does it handle that? All these are trivial in ASM, and certainly convenient in 'C' or other modern languages. There are lots of problems that BASIC can solve, but it won't generate tight code, and it won't be as fast as 'C', let alone ASM. Controlling the world is a time critical task. Until you can write precisely timed code you can't control it. RE |