On Jul 27, 11:56 pm, Alan Kent <[email protected]> wrote: > Upon reflection of course it will be faster. The first function has to > update the field 'i' per increment in case there is an index out of > bounds exception. The second only updates the field once.
One quick thing: Variable i should not be a field, it should be local to the method. This class in not thread-safe with i being used in this manner. Anyway, it would be interesting to compare those results. I suspect you'll see much less difference between the methods, as stack references are always faster than field references. Pat. -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
