Re: Code performance question #1

2006-08-07 Thread David Kerber
Thanks for the help! Leon Rosenberg wrote: data.length is evaluated each time. here's the example to demonstrate it: public class TestLoop { public static void main(String a[]){ byte data[] = new byte[10]; int counter = 0; for (int i=0; i System.out

RE: Code performance question #1

2006-08-07 Thread Peter Crowther
> From: Leon Rosenberg [mailto:[EMAIL PROTECTED] > data.length is evaluated each time. > > here's the example to demonstrate it: [Example elided that reassigns data inside the loop] That example would indeed be evaluated each time. However, *if* the compiler's sufficiently smart, it could detec

Re: Code performance question #1

2006-08-07 Thread Leon Rosenberg
data.length is evaluated each time. here's the example to demonstrate it: public class TestLoop { public static void main(String a[]){ byte data[] = new byte[10]; int counter = 0; for (int i=0; i wrote: I have a couple of questions about t

Re: Code performance question #1

2006-08-07 Thread David Kerber
By the way, this code is in a servlet running under 5.5.12, if it matters. David Kerber wrote: I have a couple of questions about the performance of my code, but I'm going to ask them in separate threads. The first one is, if I have this loop: for ( ii = 0; ii < data.length; ii++ ) {

Code performance question #1

2006-08-07 Thread David Kerber
I have a couple of questions about the performance of my code, but I'm going to ask them in separate threads. The first one is, if I have this loop: for ( ii = 0; ii < data.length; ii++ ) { where data is defined as byte[] , is the .length property evaluated each time through the loop,