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 30676 - Speed up ToolsAction
Summary: Speed up ToolsAction
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Actions (show other bugs)
Version: 3.x
Hardware: All All
: P3 blocker (vote)
Assignee: Peter Zavadsky
URL:
Keywords: PERFORMANCE, UI
Depends on:
Blocks:
 
Reported: 2003-02-05 08:30 UTC by Peter Zavadsky
Modified: 2008-12-23 13:34 UTC (History)
3 users (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Zavadsky 2003-02-05 08:30:40 UTC
See issue #27769, the part talking about ToolsAction.

There is a problem when creating popup menu,
ToolsAction menu item asks all its subActions
whether there is at least one enabled. In that
case the menu item is visible otherwise the menu
item is not visible, but is there (JInlineMenu).
This takes a longer time when no sub actio is
enabled (all of actions has to be examined->).

I guess there should be measured how much takes
the sub action enablement check and then act
accordingly.
Comment 1 Peter Zavadsky 2003-02-05 12:38:34 UTC
Well it seems the problem doesn't lie in the checking of enablement
status.

I examined inovking popup on filesystem node (where currently all
tools sub actions are disabled, i.e. all of them has to be examined.

I measured ToolsAction.G.isPopupEnabled method, which does the job.

When the popup invoked first time, the time spend in that method was
600, 700 or 300 ms. But all subsequent calls (next invocations of
popup on the same or other nodes) took just about 20 ms.

I found out that the time isn't spent in action.isEnabled method, like
it was expected but it took some time when contextAwareAction was
created first time. I guess some initialization in that modules is
done, or some classes of those modules are loaded, and therefore it is
slow.
The most slow actions were in my attempt:
org.netbeans.modules.web.dd.ConvertTo13SpecAction, 98ms
org.netbeans.modules.java.imptool.ImpToolAction, 79ms
org.netbeans.modules.javadoc.GenerateDocAction, 80ms

but also all others had some small amount which in sum gives the
bigger number.

Be aware then when you invoke it second time, it takes 0ms, and
context aware actions aren't cached, each time is a new instance created.!


Tomas please continue the investigation.



Comment 2 David Simonek 2003-02-06 16:25:16 UTC
Adding to plan for milestone 3, as this is important to solve somehow.
Comment 3 Peter Zavadsky 2003-02-07 14:09:35 UTC
Fixed in [trunk]

core/ui/../ContextMenuWarmUpTask.java 1.2

Note:
Actually the problem seems to be that there is done something when
first time the popup is created, i.e. when context aware instances of
tools sub actions are first time created (used in popup).

I guess it isn't a class loading problem (like I thought before), but
that there is some init done either in those context sensitive
instances or in lookup (template/result) which is used by those actions.

 I didn't go further, but created warm up task which solves the
problem of first invocation (it simulates the first invocation).

On my machine it saves from 300-500ms (sometime even more!) upon the
first popup invocation. 
You can measure it the way that you measure how long takes method
ToolAction.G.isPopupEnabled() processing.

Comment 4 dnoyeB 2003-02-10 15:28:51 UTC
Congratulations.  I have this issue when I right click ant tree item
for first time during session. Takes about 1.5 seconds on my XP1800+.