tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Kerber <dcker...@verizon.net>
Subject Re: Code performance question #1
Date Mon, 07 Aug 2006 15:54:20 GMT
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++ ) {
>
> where data is defined as byte[] , is the .length property evaluated 
> each time through the loop, or is it only evaluated once?  I know many 
> languages only evaluate it once, so there's no performance benefit to 
> storing it in an integer and using that as the loop upper index, but 
> don't know if that is also the case for Java.  The data length usually 
> runs about 50 bytes, and this loop is executed more than 2 million 
> times per day, so even a small performance improvement is helpful.
>
> Thanks for any info!
> Dave
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message