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 27771 - Improve UI responsiveness of editor context menu
Summary: Improve UI responsiveness of editor context menu
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@editor
URL: http://performance.netbeans.org/respo...
Keywords: PERFORMANCE, UI
: 27539 (view as bug list)
Depends on:
Blocks: 26581 27780 34161
  Show dependency tree
 
Reported: 2002-10-03 14:50 UTC by _ rkubacki
Modified: 2007-11-05 13:42 UTC (History)
6 users (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments
Done. Waiting for UI approval before commiting. (26.49 KB, image/jpeg)
2003-01-20 16:36 UTC, Martin Roskanin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ rkubacki 2002-10-03 14:50:21 UTC
First invocation is exceptionally slow.
Comment 1 Tomas Pavek 2002-10-15 09:10:32 UTC
*** Issue 27539 has been marked as a duplicate of this issue. ***
Comment 2 Tomas Pavek 2002-10-15 09:11:42 UTC
Mila Metelka wrote in issue 27539:

The performance of opening the java editor popup
menu mainly suffers from displaying of the "Goto
Source" and "Goto Declaration" items. For them to
be displayed they current caret context needs to
be evaluated by the code completion which can be
slow especially in cases when the code completion
was not initialized yet.

Comment 3 Tomas Pavek 2002-10-15 09:17:24 UTC
First invocation of context menu takes about 2.5 sec (in current dev
builds, ColorPreview.java, at the very beginning of the file).
Eliminating "Goto Declaration" and "Goto Source" actions reduces the
time to cca 900ms. Invoking menu on DataObject first
(ColorPreview.java) gives about 650ms. Still too much for a context
menu...
Comment 4 Miloslav Metelka 2002-10-15 15:23:40 UTC
The editor's popup menu also displays some additional actions,
ToolsAction etc.
It should be possible to disable individual actions and see the
invocation differences.
Comment 5 Tomas Pavek 2002-10-17 09:54:16 UTC
Just for reference - editor context menu performance was already being
solved year ago - see issue 15794.
Comment 6 David Simonek 2002-11-19 16:47:58 UTC
Dafe's measurements - testing conditions: PC Dell Pentium III, 600Mhz,
512 MB memory, JDK 1.4.1, Netbeans Main trunk build, mounted sampledir
local filesystem, opened 8 java source files, 3 plain text files.
times in milliseconds, first number shows first invocation, followed
by subsequent invocations.
3234, 94, 94, 140
Comment 7 Marian Mirilovic 2002-11-21 16:45:48 UTC
Marian's measurement (time in milliseconds):
conditions: 
 - SUN UltraSparc60 / 512 MB RAM / Solaris 5.8 / CDE
 - JDK1.4.1(01)
 - [nb_dev](200211140100) , MDI
	- mounted sampledir

bring editor popup menu on positions (cursor - <>):
 ColorPreview - "class <>ColorPreview"
		2774	84	110
 ColorPreview - "javax.swing.JPa<>nel"
		3755	112	99

Test cases are described on page :
http://performance.netbeans.org/qa/TestSuites.html#popup_menu_source_editor_java_file
Comment 8 Tomas Pavek 2002-11-22 14:41:56 UTC
I think one way (if possible) to improve this is to try to have a
static context menu created just once for each file (automatically
after opening the file in the editor). The "Goto..." actions would not
be enabled according to context (caret position), but permanently,
doing nothing if not valid.

The question is whether the menu can be static (have fixed content),
and whether there is a reasonable moment when to pre-create the menu
(should be when a file is displayed or focused, not just when opened). 
Comment 9 _ rkubacki 2002-11-25 15:34:51 UTC
Radim's measurement:
PIII/800MHz, Linux (2.4.17), 512MB
NetBeans IDE Dev (Build 200211180100)
Java; VM; Vendor      = 1.4.1; Java HotSpot(TM) Client VM 1.4.1-b21;
Sun Microsystems Inc.

mounted sample dir and openide/src directory
2. Editor context menu 

5270, 310, 217, 212
2956, 247, 240, 198

Comment 10 Tomas Pavek 2003-01-13 17:51:36 UTC
Should wait cursor be set while constructing & showing the context menu?
Comment 11 Miloslav Metelka 2003-01-14 12:28:35 UTC
IMO once we no longer wait for the code completion to evaluate the
context menu could popup fairly quickly so the wait cursor would not
be necessary. We'll try and see.
Comment 12 Martin Roskanin 2003-01-14 15:54:06 UTC
fixed in [maintrunk]

The slow responsivness was caused by slow "Go to source" and "Margin"
menu item. During the first invocation of the context menu the code
completion DB is checked, whether it is initialized. If not,
initialization runs in RequestProcessor and the menu item is displayed
without the name of the class. It could be possible, that first
invocation of the menu can be faster than further, because in the next
invocations the "Go to source" menu item retrieves the name of
searched class and the completion query is performing. Please, try to
make some measurements to verify it. If the responsiveness will not be
sufficient, querying will be omitted.

/cvs/editor/libsrc/org/netbeans/editor/Annotations.java,v  <-- 
Annotations.java
new revision: 1.10; previous revision: 1.9

/cvs/editor/src/org/netbeans/modules/editor/java/Bundle.properties,v 
<--  Bundle.properties
new revision: 1.44; previous revision: 1.43

/cvs/editor/src/org/netbeans/modules/editor/java/JCStorage.java,v  <--
 JCStorage.java
new revision: 1.43; previous revision: 1.42

/cvs/editor/src/org/netbeans/modules/editor/java/JavaKit.java,v  <-- 
JavaKit.java
new revision: 1.48; previous revision: 1.47
done

Comment 13 Tomas Pavek 2003-01-20 14:05:23 UTC
The responsiveness is much better (first invocation went down from cca
2500 ms to 600ms), but it's still not quite perfect.

I also noticed the subsequent invocations can be slow - most probably
caused by computing the source name for the Goto Source action. I
think it is bad to slow whole context menu just for one menu item
(which the user might not be interested in at all). What about to
create a "Goto" submenu with "Declaration" and "Source" items? Then
the slowness would appear only if user really wanted the Goto Source
action (clicked on the Goto submenu). HIE opinion?

I've tried to eliminate the source name computation and the first menu
invocation went down to 500ms - not so big improvement - but the
subsequent invocations were much more fluent. So I think it's worth
trying.
Comment 14 Martin Roskanin 2003-01-20 16:36:31 UTC
Created attachment 8626 [details]
Done. Waiting for UI approval before commiting.
Comment 15 dpavlica 2003-01-21 08:51:48 UTC
I would like to ask about situation, when only one subitem (e.g. Go to
Declaration) will be active. Does it mean, that First Context menu
will contain "Go to" item a second one only  "Go to Declaration" item
? It's curious a bit. OR will second context menu include both items
always (Go to Declaration and Go to Source), but some of them will be
disabled ?
Comment 16 Martin Roskanin 2003-01-21 09:16:43 UTC
There is only "go to declaration" subitem under "Go to" item, if "go
to source" is disabled.
I can change it to "disabled go to source" behaviour. 
Would it be better?

Comment 17 Martin Roskanin 2003-01-21 10:38:45 UTC
fixed in [maintrunk] in accordance with UI team comments

/cvs/editor/libsrc/org/netbeans/editor/Annotations.java,v  <-- 
Annotations.java
new revision: 1.11; previous revision: 1.10

/cvs/editor/src/org/netbeans/modules/editor/NbEditorKit.java,v  <-- 
NbEditorKit.java
new revision: 1.37; previous revision: 1.36

/cvs/editor/src/org/netbeans/modules/editor/java/Bundle.properties,v 
<--  Bundle.properties
new revision: 1.45; previous revision: 1.44

/cvs/editor/src/org/netbeans/modules/editor/java/JavaKit.java,v  <-- 
JavaKit.java
new revision: 1.49; previous revision: 1.48

/cvs/editor/src/org/netbeans/modules/editor/resources/layer.xml,v  <--
 layer.xml
new revision: 1.32; previous revision: 1.31
Comment 18 Tomas Pavek 2003-01-28 16:16:36 UTC
OK, after the last commit, the first context menu invocation time was
around 500ms (dev build 20030127, 733MHz P3, W2K). Implementing
warm-up in issue 27769 helped significantly,
so the time is now around 250ms (dev build 20030128).
Quite good improvement comparing to the original 2.5s I think...
Comment 19 Marian Mirilovic 2003-02-04 18:06:55 UTC
Marian's measurement (time in milliseconds):
conditions: 
- SUN UltraSparc60 / 1024 MB RAM / Solaris 5.8 / CDE
- JDK1.4.1(01)
- [nb_dev](200302040100) , MDI
	- mounted sampledir

bring editor popup menu on positions (cursor - <>):
   ColorPreview - "class <>ColorPreview"
	1018    143     266
   ColorPreview - "javax.swing.JPa<>nel"
   	1016    190     223
Comment 20 Patrick Keegan 2003-02-14 23:26:11 UTC
I'm reopening to suggest new wording in the menu.

Go to -> Go To    [we have an editorial guideline that says all 
prepositions are capitalized if they are the last word]

Go to Source -> Source
Go to Declaration -> Declaration

"Go To" doesn't need to be repeated.

If possible, I'd like to see this change be made (I'm speaking on 
behalf of Docs). Do others agree?
Comment 21 Tomas Pavek 2003-02-17 18:05:08 UTC
I agree. I'll do the change and integrate it.
Comment 22 Tomas Pavek 2003-02-18 15:02:41 UTC
Done.

/cvs/editor/libsrc/org/netbeans/editor/Bundle.properties
new revision: 1.31; previous revision: 1.30

/cvs/editor/src/org/netbeans/modules/editor/java/Bundle.properties
new revision: 1.46; previous revision: 1.45
Comment 23 Martin Roskanin 2003-05-27 14:55:51 UTC
integrated into [prj40_prototype] also.

/cvs/java/completion/src/org/netbeans/modules/java/completion/updater/Attic/JCStorage.java,v
 <--  JCStorage.java
new revision: 1.1.2.1.2.2.2.6; previous revision: 1.1.2.1.2.2.2.5

/cvs/java/editor/src/org/netbeans/modules/editor/java/Attic/Bundle.properties,v
 <--  Bundle.properties
new revision: 1.1.2.1.4.1; previous revision: 1.1.2.1

/cvs/java/editor/src/org/netbeans/modules/editor/java/Attic/JavaKit.java,v
 <--  JavaKit.java
new revision: 1.1.2.1.2.1.2.5; previous revision: 1.1.2.1.2.1.2.4

/cvs/java/editor/src/org/netbeans/modules/java/editor/resources/Attic/layer.xml,v
 <--  layer.xml
new revision: 1.1.2.1.4.3; previous revision: 1.1.2.1.4.2

/cvs/editor/libsrc/org/netbeans/editor/Annotations.java,v  <-- 
Annotations.java
new revision: 1.9.10.1; previous revision: 1.9

/cvs/editor/libsrc/org/netbeans/editor/Bundle.properties,v  <-- 
Bundle.properties
new revision: 1.29.18.2; previous revision: 1.29.18.1

/cvs/editor/src/org/netbeans/modules/editor/NbEditorKit.java,v  <-- 
NbEditorKit.java
new revision: 1.35.10.3; previous revision: 1.35.10.2