Which Java version are you on? From Java 9 to Java 12, text measurement was very slow, until https://bugs.openjdk.java.net/browse/JDK-8220231 was fixed in Java 13. (A new text shaping engine was introduced in Java 9, and it took some releases to iron out the kinks.)
-- Eirik -----Original Message----- From: Laszlo Kishalmi <[email protected]> Sent: Friday, January 3, 2020 5:24 AM To: Apache NetBeans <[email protected]> Subject: Smart people needed for a proper patch a performance bottleneck. 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.
