View Full Version : I need for speed

11-10-2010, 01:09 AM

Does some one know the language for he Prop that is fastest, excluding assemble?

That is like Spin, Prop Basic, 'C', Forth, etc.



Mike Green
11-10-2010, 01:18 AM
PropBasic would be the fastest since it's translated into assembly language. Spin is interpreted. Forth is somewhere in between interpreted and directly executed. C is compiled into LMM (Large Memory Model) assembly language which is partially interpreted and runs about 1/8 the speed of normal assembly language.

11-10-2010, 02:22 AM
Hi richaj45,

Roughly speaking, for PASM code that includes no hub accesses or other "special" instructions, the best case when this code executed as LMM is approximately 1/4 native speed. This occurs if the LMM kernel can manage to fetch an instruction in each hub window (which occurs every 16 clock cycles), and execute it completely before the next hub window arrives. For most instructions, this means they will take 16 clock cycles to execute as LMM instead of 4 clock cycles to execute as PASM - or 1/4 the speed.

However, most LMM programs will not achieve this speeed for very many instructions in a row, because they typically include instructions that themselves need to perform hub accesses - and these will take two hub windows to execute, (i.e. twice as long). I think this is what Mike means by his figure of 1/8 PASM speeds - but this is actually the worst case.

To complicate things even further, when using LMM, the normal PASM instructions are also interleaved with LMM "primitives" (a function call into the LMM kernel itself) that can take much longer to execute - a good example would be a MUL or DIV primitive. But since these primitives are implemented as a native PASM function, they take about the same time to execute in LMM as in native PASM (since the overhead of the initial LMM instruction "fetch" is amortized over the number of instructions in the function). This means that in some cases, LMM PASM is executed at comparable speed to the equivalent native PASM.

So the answer is that an LMM based language could execute a program at anywhere between the same speed as PASM, and 1/8 of the speed of PASM - but it is likely to be closer to 1/4 the speed of PASM than to either of these extremes.