eirikbakke commented on code in PR #8194:
URL: https://github.com/apache/netbeans/pull/8194#discussion_r1932420473


##########
enterprise/web.monitor/src/org/netbeans/modules/web/monitor/client/TransactionView.java:
##########
@@ -310,8 +310,8 @@ public void actionPerformed(ActionEvent e) {
                    }
                }});
 
-       timeDButton = new JToggleButton(new ImageIcon(
-                
TransactionView.class.getResource("/org/netbeans/modules/web/monitor/client/icons/timesortB.gif")),
 true);
+       timeDButton = new JToggleButton(ImageUtilities.loadIcon(
+                
"org/netbeans/modules/web/monitor/client/icons/timesortB.gif"), true);

Review Comment:
   Here's a quick profile of ImageUtilities.getIcon on NetBeans startup, with 
two maven projects and a few Java editor windows open:
   
   <img width="1352" alt="image" 
src="https://github.com/user-attachments/assets/7f3e98e2-a3bc-4b7e-8cbd-51720bed01f3";
 />
   
   This is after the switch to JSVG and after the two big ImageIcon patches 
have been applied.
   
   One interesting observation is that ClassLoader.getResources is quite 
expensive. If we could avoid calling it speculatively just to see if an SVG 
file is present for each icon, it would save some cycles.
   
   EDIT(3): The numerous calls to ClassLoader.getResources are due to 
attempting to find localized versions of every icon, as well as rollover, 
pressed, disabled etc. versions of action icons. Each call is with a separate 
speculative path, so caching would not help in these cases (and maybe the 
negative results are already cached; I didn't look into it).
   
   Note that this is just for a single run. Though the proportions seem 
consistent from run to run.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
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