[futurebasic] Re: [FB] [FB^3] optimal variable dimensioning

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 2000 : Group Archive : Group : All Groups

From: "Dr. Steven J. Stratford" <sstratford@...>
Date: Sun, 13 Feb 2000 08:28:22 -0600
>  >What are the rules of thumb for dimensioning variables so as to get
>>the best PPC performance?
>>
>>I presume that you'd DIM long vars first in a function that were used
>>the most in the function. And then what about byte boundaries etc?
>
>1. Turn on the compiler preference for Align variables to their 
>proper boundary. Now you don't have to worry about alignment at all. 
>You can DIM the vars in any order.
>
>2. Turn on the compiler preference for Register vars, or put 
>REGISTER ON early in your program. Be prepared for compiler 
>complaints about certain variables, and just DIM them with @    DIM 
>@ theVar
>
>In each LOCAL FN, the first 8 simple integer vars (byte, int or long 
>-- taken to include pointer & handle) can be register vars. The 
>numbering starts from the first parameter of the function, and 
>continues with DIMmed vars in the order of declaration.
>
>Typically you'd want to have loop control variables, and anything 
>referred to a lot inside a loop, as REGISTER.

OK this helps, thanks. As I understand it, there's a limited number 
of registers available in the PPC (16?). So how does the CPU handle 
the situation when you have more than that many REGISTER variables? 
Is there any advantage to limiting the number of register variables 
in a function to a number equal to the number of registers?


--Steve