>I got about a 25% increase in speed total in what I tried with your code. The two changes that gained the most were elimination of the ^ and removing the intermediate stores. With a good optimizing C compiler those intermediates never see real memory, they stay in the registers. In VFP thousands of lines of machine code are executing for that loop, and VFP has no optimizer. I think the only time you'd see an intermediate store improving performance is if it's a common expression that is used more than once in the loop (for example your 26^i used twice in the 10to26 loop), but I always tend to hand optimize those anyway.
>
These differences are interesting to know (VFP/C).
> I think the code is more readable without the intermediate stores. I'm biased though by the high performance and realtime systems I've worked on in the past.
>
You are right, this is a matter of who is looking at the code. When I am putting a complex routine together, I find it easier to work out mentally by breaking up the operations into intermediate store with Ultra-descriptive variable names. This helps my mentally build the process. There have been a few times that I have built a routine the way I always do, and then when I finished, rearranged it to make it more concise and efficient. Each of these times, however, I regretted it later when I had to go back and take the code apart for whatever reason, because the logic was more difficult for me to mentally organize.
Erik Moore
Clientelligence