[H-GEN] Which is better?

Lea de Groot humbug.org.au.8395 at elysiansystems.com
Sat Apr 24 07:15:04 EDT 2004


On Sat, 24 Apr 2004 18:12:54 +1000 (EST), Harry Phillips wrote:
> First code:
> int arrayLen = myArray.length;
> for (int i = 0; i < arrayLen; i++)
> ...
> 
> 
> Second one:
> for (int i = 0; i < myArray.length; i++)
> ...

Absolutely, the first example is more efficient.
But given the scale of most machines these days, this isnt the first 
thing we worry about.
First, write clear code.
Optimise when you have performance issues - without that, clear code is 
far more important.

HIH
Lea
-- 
Lea de Groot
Elysian Systems - http://elysiansystems.com/




More information about the General mailing list