I played around with the suggestions.

First of all it takes 22-24 seconds from the appearance of the main window to get the currently edited file displayed in the editor. That's my baseline.

It is slow for two reasons: the setText call on the JLabel invokes the HTML rendering code. Then it creates cascade of property change events.

Overriding the TabDataRenderer.RendererPanel methods makes it faster but it also makes the UI unusable. Changed the renderer.label to DefaultTableCellRenderer() that was faster but crippled the tabs. Same with HTMLRenderer.createLabel(). If I used the HTMLRenderer sole for measuring text then the main UI did not come up.

I even tried to cache the width. That resulted crippled UI. So it seems that the component is dependent on those setText and fired properties.

Final thought using any of the performance trick made opening the IDE happen in ~8 secs. So if done properly this could be a real win. (BTW the other 8 secs is mostly IO deserialization on the AWT thread)

I filed an issue for this as NETBEANS-3666


On 1/3/20 9:10 AM, Karl Tauber wrote:
Hi Laszlo,

on my machine I have the side-effect that the tabs are wider. There is larger empty space between the text and the close button.

The reason is that the tab text always starts with "<html>" and for modified files the tab text contains "<b>"..."</b>".

The necessary HTML parsing could be one problem that makes it slow.
To check this, you could try to simply remove the leading "<html>", enable the old code (setText()) and check whether it starts faster.


BTW the new width calculation does not include the width of the close button and the label insets.


Another problem is that TabDataRenderer.getPreferredWidth() is invoked very often. If I have only 15 files open, this method is invoked more than 600 times on startup. And each additional open file makes it worse. There are a lot of tableChanged events. See TabTable constructor.



Another reason could be that class TabDataRenderer.RendererPanel does not override the methods that javax.swing.table.DefaultTableCellRenderer for performance reasons.

Could you add following methods to TabDataRenderer.RendererPanel and check whether it starts faster?

public void invalidate() {}
public void revalidate() {}
public void repaint(long tm, int x, int y, int width, int height) {}
public void repaint(Rectangle r) {}
public void repaint() {}
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {} public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {}


Karl


On 03.01.2020 05:24, Laszlo Kishalmi wrote:
Dear all,

I've recently experienced that NetBeans is unresponsive for 5-10 secs after the main screen opens. It does not really bother me as I open NetBeans up once or twice a week. I have ~46 projects loaded (mostly NetBeans modules).

I've tried to profile what is happening. Though right now the profiler attachment crashes (an other issue maybe it is just on my machine) the JVM running the profiled NetBeans in 10-15 secs, I could get some valuable info.

It seems there is a performance bottleneck in multitabs implementation.

org.netbeans.core.multitabs.impl.TabDataRenderer.getPreferredWidth(Object) is being called several times spending considerable amount of time setting the text on a JLabel over and over:

https://github.com/apache/netbeans/blob/06b3e677d9ea4dbd9987c8245fe5be776e8245f8/platform/core.multitabs/src/org/netbeans/core/multitabs/impl/TabDataRenderer.java#L144

The purpose of these calls is to properly measure the width of the rendered component.

I've tried to cheat by replacing:

renderer.label.setText( text );
renderer.label.setIcon( icon );
res = renderer.getPreferredSize().width;

With:

AffineTransform transform = new AffineTransform();
FontRenderContext frc = new FontRenderContext(transform, true, true);
Font font = renderer.label.getFont();
res = icon.getIconWidth() + renderer.label.getIconTextGap() + (int) font.getStringBounds(text, frc).getWidth();

That, kind of, worked. The IDE starts up faster there is no visible side-effect (yet), however I would like someone who is more into swing to come up with a proper implementation, that handles HIDPI and html labels. Should not be hard, I just do not have the proper knowledge.




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to