Hi Justin,

> A simple example: Why is this loop
>
> for(int i = count; --i >= 0 ; )
>
> faster than this loop
>
> for(int i = 0; i < count - 1; i++ )
>
> given exactly the same loop content?

Ok, here is my coming out. I do programming now but don't have a solid
programmer's education background. So I can't tell you why the first loop is
faster. But I really would like to know more about what's going on under the
hood. Could you please explain to me ?

The only thing what I can see is the count - 1 statement. Is it calculated
after every loop step ? Will the compiler only optimize this if count is
declared const(final) ?

Is this equivalent to the first loop ?
const int tempCount = count - 1;
for( int i = 0; i < tempCount; i ++)

regards
Paul

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to