Last week I was fighting with very strange performance issue. We have quite complicated JPanel form and I was doing some performance opmtimization. I thought that it is now OK, but when then same form was executed as component inside NetBeans Rich Client Platform, it was horribly slow.
Method containing only if
condifition that was false in most cases took 0 ms (unmesureable) when run in standalone frame. In NetBeans RCP the same code took about 200 ms. The same code processing the same data!
It drived me crazy so I asked in Czech Java Conference.
And Filip Jirsák saved me as he told me about strange NetBeans RCP feature: if your code calls System.out.flush()
(and may regard System.err.flush()
too) then NetBeans blocks thread that called the flush() until flush ends.
In case that you call flush()
from AWT Event Queue then whole application block every time flush() is called.
Our application contains quite heavy usage of logging framework Logback and this was the cause of slowness.
So I have added one line (property immediateFlush of WriterAppender set to false) into our logback.xml
and application is now at normal speed.
Nice puzzle! I can imagine you really enjoyed this investigation 🙂
I’m enjoying whole CADET project. Especially time before release :-/