TOMÁŠ HUBÁLEK BLOG: BAVTE SE PŘIMĚŘENĚ…

Netbeans performance problem: JPanel form is much slower if running inside RCP

Written By: Tomáš Hubálek - Aug• 05•09

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.

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

2 Comments

  1. Nice puzzle! I can imagine you really enjoyed this investigation 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *