Strange performance issue
Hi,
I've been programming Java professionally for 10 years and I've seen som weird sh*t over the years, but this one takes the cake:
I have a huge complex application that does all kinds of funny stuff with doubles. In a specific test case, one method is called ~3000 times and covers 25% of total execution time, so I figured I'd optimize it a bit.
To cut a long story short, by accident, I discovered that ADDING one single line to this one method consistently reduced total test time from 3.9sek to 2.6sek:
m_Limits =new double[1];
m_Limits is a private membership variable that is NEVER accessed anywhere else - this is the only time this member is ever touched.
changing it to
if(m_Limits==null) m_Limits =new double[1];
Took off an additional 0.2sek, but moving it to the constructor removed the optimization entirely. The same happens if m_Limits is declared as a local variable.
Have I run in to some kind of hotspot fluke - has anyone else ever experienced anything like this?

