-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve performance of icon loading in ImageUtilities #8207
Comments
(Repeating my profiling results from the other thread:) Here's a quick profile of ImageUtilities.getIcon on NetBeans startup, with two maven projects and a few Java editor windows open: This is after the switch to JSVG and after the two big ImageIcon patches have been applied. Note that this is just for a single run. Though the proportions seem consistent from run to run. (Repeating again results from the other thread.) The many calls to getResource are due to many suffix variations attempted for each icon base path. For example, here are all the non-existent variations that are attempted to be loaded, excluding SVG extensions, for a single icon:
There are many duplicate SVG icons in the NetBeans repo, but this does not appear to contribute significantly to startup time. Most of the icons loaded at startup are in fact distinct images. |
since the point was brought up that all (or most) icons should be loaded with localized=true: I don't have anything against this, but please wait a bit with this change till things settled. The localized code path is more complex and has more indirections, lets not change too many things at once ;) (there is also some potential for a cleanup of regarding image loading performance: it is something worth having an eye on, but me measuring #8194 (comment) didn't mean that i felt performance was insufficient. It also doesn't even mean that it influences startup, the bottleneck could be somewhere else and this happens in parallel decoupled from the bottleneck. Lets balance complexity with effect - there is a chance that everything will be still fine even after everything calls into edit: linking to closed conversations doesn't seem to work, here the content of the linked comment: mostly EDT as of today (pending PRs not applied! - this has to be repeated):
removing the critical section wouldn't change much at the moment. another metric: about 450ms is spent for loading icons during startup |
Could you clarify which change you are referring to here? Optimizing ImageUtilities, changing localized=true/false defaults, or merging one of the existing PRs? |
second paragraph is referring to: "since the point was brought up that all (or most) icons should be loaded with localized=true" Which I don't have anything against, but I do think should happen after the global |
Thanks, understood! Yeah, I wasn't planning any immediate work on this myself; it was just good to have the discussion around for the future. |
Given that point was made by me, let's clarify what was meant. 😄 All icons / images should be brandable. I agree with Eirik that very few images actually need to be localizable. At this point, I wouldn't look to fix the usages across the code base. We might just consider existing uses on a case by case basis if a downstream consumer complains about un-brandable usage. If we do want to look at this from a branding perspective, or there's evidence it's necessary from a performance perspective, I would look at EDIT: or alternatively make locale suffixes dependent on a system property that can be enabled in the platform if required. Do we actually need locale suffixes anywhere in the IDE? |
Body
With NetBeans now containing more SVG icons, and with more icons being loaded via ImageUtilities rather than alternative methods, it might be worth taking a look at the performance of ImageUtilities.getIcon, and see if there are possible optimizations that should be done. A first step, switching from Batik to JSVG, was already done.
This issue is intended to continue the discussion that was started in a comment in another issue.
Committer
The text was updated successfully, but these errors were encountered: