How many of these actually matter any more?
On Sat, Nov 2, 2013 at 7:52 AM, Sean Owen <sro...@apache.org> wrote: > In Math, is there any appetite for large patches containing many > instances of particular micro-optimizations? Examples: > > - Replace: > a[i][j] = a[i][j] + foo; > with: > a[i][j] += foo; > … which is faster/leaner in the byte code by a little bit. It might > make a difference in many nested, tight loops. > Does this actually matter after the JIT takes hold? And if the JIT doesn't care to optimize this away, does it even matter? > - Inefficient toArray() calls with 0-length arg > - Using Map.entrySet() instead of keySet() + get()s > I think that this actually really does matter, but escape analysis has gotten dramatically better lately and may make the associated object creation much less of an issue. > - Unnecessarily non-static private methods/classes > This is stylistic and important. > - StringBuffer vs StringBuilder > I know for a fact that escape analysis in recent JVM's gets rid of the locks in most StringBuilder idioms and this just doesn't matter any more.