On Wed, Sep 07, 2011 at 01:16:03PM +0100, Mark Thomas wrote: > On 07/09/2011 12:49, Gilles Sadowski wrote: > > On Wed, Sep 07, 2011 at 11:39:37AM +0100, Mark Thomas wrote: > >> On 07/09/2011 11:34, er...@apache.org wrote: > >>> Author: erans > >>> Date: Wed Sep 7 10:34:49 2011 > >>> New Revision: 1166099 > >>> > >>> URL: http://svn.apache.org/viewvc?rev=1166099&view=rev > >>> Log: > >>> Added "final". > >>> Moved declaration of "sum" where it is used. > >> > >> You might want to re-consider that. I suspect sum was declared outside > >> of the inner loops to save allocating memory for a new double on every > >> iteration of the loop. It may be worth moving the declaration outside > >> the outer loop too. > > > > Reducing scope makes for clearer code and can lead to _more_ optimized code. > > Cleaner code, certainly. > > As far as optimisation goes I'm not so sure with a primitive. On further > research it looks like the performance should be identical. For an > "interesting" discussion on what exactly is going on I found this: > http://www.javalobby.org/java/forums/t16730.html?start=0
So: - Cleaner code: Yes - Faster code: Maybe - Higher memory usage: No Do we agree that the change is fine? Gilles --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org