Bug 101434 - [Contexts] performance: Slow cursor navigation in Text fields
Summary: [Contexts] performance: Slow cursor navigation in Text fields
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux-GTK
: P2 major (vote)
Target Milestone: 3.1.1   Edit
Assignee: Douglas Pollock CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
: 104205 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-23 09:08 EDT by Tom Hofmann CLA Friend
Modified: 2005-09-26 13:45 EDT (History)
6 users (show)

See Also:


Attachments
updateShellKludge.zip (5.07 KB, application/x-zip-compressed)
2005-06-23 10:30 EDT, Tom Hofmann CLA Friend
no flags Details
Patch to "org.eclipse.ui.workbench" (1.78 KB, patch)
2005-06-23 11:39 EDT, Douglas Pollock CLA Friend
no flags Details | Diff
Patch to "org.eclipse.ui.workbench" (3.96 KB, patch)
2005-06-23 11:44 EDT, Douglas Pollock CLA Friend
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Hofmann CLA Friend 2005-06-23 09:08:52 EDT
N20050623-0010-gtk

Not sure whether this is my particular install or a new problem.

With the above build, cursor navigation in any text field is extremely slow.

Steps:
- open the Find dialog (alternatively: open the preference dialog, or the
Team>Create Patch wizard)
- in a text field, enter some text, at least 20 characters
- press and hold the ARROW_LEFT / _RIGHT keys 

Expected: I see the caret move through the entered text
Actual: The cursor does not visibly change its position until after releasing
the key plug some delay.

Notes:
- keyboard repeat rate is at the default
- the same works fine (+/- at least nowhere near the slowness of Text fields) in
text editors
- other applications do not show this behavior

This is quite bad as the caret cannot be placed reliably this way. Will try to
reproduce with an SWT-only example.
Comment 1 Tom Hofmann CLA Friend 2005-06-23 09:10:56 EDT
Hm - probably not SWT related. I only see the behavior in my development
workbench, not the target.
Comment 2 Tom Hofmann CLA Friend 2005-06-23 09:18:50 EDT
Has nothing to do with SWT - I can only reproduce while either a file is open in
a Java editor or while in the Java perspective. When in the resource perspective
and only text editors open, cursor navigation is fast as expected.

I assume there is a listener somehwhere that causes this.
Comment 3 Steve Northover CLA Friend 2005-06-23 09:51:54 EDT
Tom, if this has nothing to do with SWT, is this bug report mis-filed?
Comment 4 Tom Hofmann CLA Friend 2005-06-23 10:01:09 EDT
I profiled the following scenario:
- Java editor
- press Ctrl+F to open the find dialog
- enter "foo bar foo"
- put caret to the end of the text
- press and hold ARROW_LEFT

Profiling reveals the following:
- Of ~1526ms spent in Display.readAndDispatch, 1486ms are burnt in
ContextAuthority.sourceChanged.

I suspect that either:
- SWT does not filter events as it should, or
- UI registers a listener where it should not

Comment 5 Tom Hofmann CLA Friend 2005-06-23 10:02:13 EDT
(In reply to comment #3)
> Tom, if this has nothing to do with SWT, is this bug report mis-filed?

It might be - see comment 2. Will move as soon as I have traced the cause, ok?
Comment 6 Douglas Pollock CLA Friend 2005-06-23 10:23:29 EDT
I have reason to believe, perhaps prematurely, that this is the result of a
change made about a month ago to how contexts work.
Comment 7 Tom Hofmann CLA Friend 2005-06-23 10:24:48 EDT
(In reply to comment #4)
> - Of ~1526ms spent in Display.readAndDispatch, 1486ms are burnt in
> ContextAuthority.sourceChanged.

... which is called by the GTK-only ContextService.updateShellKludge (see bug
95792). This explains why this is not reprducable on the other platforms.
Comment 8 Tom Hofmann CLA Friend 2005-06-23 10:30:41 EDT
Created attachment 23850 [details]
updateShellKludge.zip

Html yourkit trace of the children of ContextServie.updateShellKludge. The
context seems to be reloaded and the all menus rebuilt on every keystroke.
Comment 9 Tom Hofmann CLA Friend 2005-06-23 10:33:40 EDT
Verified that this appeared between M7, which still worked as expected, and RC1.
Comment 10 Douglas Pollock CLA Friend 2005-06-23 11:39:31 EDT
Created attachment 23868 [details]
Patch to "org.eclipse.ui.workbench"

This problem traces its history back to Bug 56231, and its reincarnation as Bug
95222.	Unfortunately, when porting the kludge for 56231, I seem to have missed
a key point: the forced update should only happen if the shell has really
changed.

This fix simply does a test to see if the shell has really changed.
Comment 11 Douglas Pollock CLA Friend 2005-06-23 11:44:31 EDT
Created attachment 23869 [details]
Patch to "org.eclipse.ui.workbench"

This extends the fix to include the handlers as well.

I would like to recommend this fix for 3.1.1.  Changing it at this point is too
risky for the 3.1.  It has the possibility of making key bindings stop working
on GTK+.  If key bindings stop working due to some side effect of this bug,
then I would expect that they can be made to work again by switching to another
application and back again.

Leaving this problem in causes a performance hit for typing on GTK+.
Comment 12 Dani Megert CLA Friend 2005-06-23 12:12:24 EDT
Since typing in the editor itself and working with code assist is not affected I
agree with Doug's assessment to defer this to 3.1.1.
Comment 13 Michael Van Meekeren CLA Friend 2005-06-23 16:43:22 EDT
I've seen the bug and I think it is a P2, doug if you disagree let me know
Comment 14 Douglas Pollock CLA Friend 2005-07-21 13:08:49 EDT
MVM: Approval for 3.1.1?  
Comment 15 Douglas Pollock CLA Friend 2005-07-21 15:43:37 EDT
Patch applied to head in the 3.2 stream.  Waiting for approval to commit a fix 
to the 3.1.1 stream.... 
Comment 16 Michael Van Meekeren CLA Friend 2005-07-21 16:08:02 EDT
approve for 3.1.1
Comment 17 Douglas Pollock CLA Friend 2005-07-21 16:48:37 EDT
Fixed in CVS on the maintenance stream.  org.eclipse.ui.workbench branched, 
and plug-in version number updated. 
Comment 18 Billy Biggs CLA Friend 2005-07-25 11:12:52 EDT
*** Bug 104205 has been marked as a duplicate of this bug. ***
Comment 19 Tom Hofmann CLA Friend 2005-08-04 08:21:27 EDT
Verified in M20050727-1200-gtk
Comment 20 Douglas Pollock CLA Friend 2005-09-26 13:45:02 EDT
Verified in 3.1.1 RC2 and 3.2.  GTK+ 2.6.8.