This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 199137 - LowPerformance took 21493 ms.
Summary: LowPerformance took 21493 ms.
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Projects UI (show other bugs)
Version: 7.0
Hardware: All All
: P2 normal (vote)
Assignee: Jesse Glick
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2011-06-03 11:15 UTC by Vladimir Voskresensky
Modified: 2011-06-24 07:56 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 179154


Attachments
nps snapshot (59.59 KB, application/nps)
2011-06-03 11:15 UTC, Vladimir Voskresensky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Voskresensky 2011-06-03 11:15:32 UTC
This issue was reported manually by vv159170.
It already has 1 duplicates 


Build: NetBeans IDE 7.0.1 Dev (Build 20110603-4e44b7e2d1d1)
VM: Java HotSpot(TM) 64-Bit Server VM, 19.1-b02, Java(TM) SE Runtime Environment, 1.6.0_24-b07
OS: Linux

User Comments:
vv159170: invoking popup menu on folder in Favorites (folder is from remote FS)



Maximum slowness yet reported was 21493 ms, average is 21493
Comment 1 Vladimir Voskresensky 2011-06-03 11:15:38 UTC
Created attachment 108695 [details]
nps snapshot
Comment 2 Vladimir Voskresensky 2011-06-03 17:18:50 UTC
20 sec to wait for popup is way too long
Comment 3 Vladimir Voskresensky 2011-06-03 17:22:19 UTC
Open project action from context menu is invoking very expensive method from UI thread

Way to reproduce:
- add remote FS to Favorites, 
- right click on folder
Comment 4 Jesse Glick 2011-06-07 16:29:19 UTC
Two separate items in the snapshot:

1. OpenProjectList.LoadOpenProjects.resultChanged does some work synch, some asynch. It should likely do it all asynch.

2. OpenProjectFolderAction.ContextAction.<init> updates its label and enablement status based on project information. Surprisingly the snapshot does not show it blocking while loading the project - which would be plausible enough - but when getting the display name, which winds up loading the icon too, which is apparently nontrivial in a make project. Not obvious what the right fix is; it is probably necessary to immediately decide whether the project exists (so the menu item can be shown or not - unacceptable to remove a context menu item a moment after the menu appears), but setting the label could probably be done asynch.
Comment 5 Vladimir Voskresensky 2011-06-07 18:14:40 UTC
For long validating actions we use the following approach:
- show action in disabled state immediately and with text "ActionName (Validating...)"
- Validation itself is run on bg thread
- When finished => enable state is changed and text is updated as well

It solves the problem for users who are not interested in action itself, but interested in other actions from popup menu
Comment 6 Jesse Glick 2011-06-07 19:34:03 UTC
(In reply to comment #5)
> For long validating actions we use the following approach

Right, but not suitable for use with DynamicMenuContent.HIDE_WHEN_DISABLED.
Comment 7 Jesse Glick 2011-06-07 23:27:35 UTC
(In reply to comment #4)
> setting the label could probably be done asynch.

Requires some changes in o.o.a.Actions, which is not expecting that. Even with that fixed, it does not really work well; if the label is changed to something longer than the usual popup width, at least in GTK L&F on JDK 6 the menu item is simply truncated - i.e. the JPopupMenu does not expand to hold it - which looks terrible.

The only fix I can think of is to simply not adjust the menu item label to match the project display name at all.
Comment 8 Jesse Glick 2011-06-07 23:51:44 UTC
core-main #a0eaffd59b2d
Comment 9 Quality Engineering 2011-06-10 14:47:23 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/94c7c19e4edb
User: Jesse Glick <jglick@netbeans.org>
Log: Permit actions bound to menu items to update visible properties (e.g. label) asynchronously.
(Mentioned in bug #199137 comment #7 though not used in that case as Swing does not seem to handle this well.)
Non-menu bridges could already do so; for menus, the hierarchy listener was disabled, but the regular listener was never added.
Also making the regular listener weak, in case a singleton action somehow acquires many presenters (possible though unlikely).
Comment 10 Jesse Glick 2011-06-20 13:15:30 UTC
Have you been able to verify the fix? Do you need it backported to 7.0.1?
Comment 11 Vladimir Voskresensky 2011-06-20 13:42:56 UTC
I don't know if it works better, because I still get 10-15 sec delay which is now associates with http://netbeans.org/bugzilla/show_bug.cgi?id=197004
Comment 12 Jesse Glick 2011-06-22 12:59:56 UTC
Then I would probably ask for a waiver: the fix is probably safe, but is not known to be effective. Anyway I suppose that ironing out all the kinks in the remote filesystem support is going to take some time and is not something we can expect in 7.0.1.