Bug 78450 - [Performance] PasteAction is making selection slow
Summary: [Performance] PasteAction is making selection slow
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.1   Edit
Assignee: Tobias Widmer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-11 17:37 EST by Veronika Irvine CLA
Modified: 2004-11-17 07:05 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Veronika Irvine CLA 2004-11-11 17:37:02 EST
The method PasteAction.canOperateOn is invoked on every selection change.  
This is not required and is extremely slow on many platforms.

The PasteAction is checking that there is something on the clipboard that can 
be pasted on every single selection change event.  This is an expensive 
operation and is entirely unneccessary.  The check should be done when the 
user invokes Ctrl+V or when the user opens the context menu.  

In addition to being slow, it is not correct.  Another application could 
change the contents of the clipboard invalidating the check performed on 
selection change.  I am not quite sure why the selection has anything to do 
with pasting other than the fact that on paste, the selection will be 
replaced.  At one time when there was a Paste toolitem in the toolbar, back 
then it was neccessary to poll the clipboard to toggle the enabling of the 
toolitem but I do not understand why that was tied to selection.  I can change 
the contents of the clipboard to not contain any valid data using another 
application and the Paste menu item is still enabled in the context menu of 
the java editor.
Comment 1 Billy Biggs CLA 2004-11-11 18:16:22 EST
Doug and I did a test where we copied a lot of text in another application
(acroread), and then rapidly switched between two editor tabs in Eclipse
(Linux-GTK+).  We then selected some text in the Eclipse editor and rapidly
switched between two tabs.  We did not profile this case, but there seemed to be
a visible performance difference.

If the clipboard contents could be only checked before the context menu is
filled, I think it would help out performance on this platform.  See bug 78458
for a similar problem in the UI code.
Comment 2 Dirk Baeumer CLA 2004-11-12 05:16:28 EST
Only checking when the context menu opens isn't an options since equivalent
support is missing for global menus, toobars and short cuts (e.g we have to know
when the global Edit menu pops up or when the user pressed Ctrl+V to adjust the
availability of the action).

I agree that we shouldn't do the check on selection change. We should perform it
on run.
Comment 3 Dirk Baeumer CLA 2004-11-15 06:25:07 EST
Tobias,

a reorg move bug ;-). Please step by if you have questions.
Comment 4 Tobias Widmer CLA 2004-11-17 07:05:26 EST
Fixed > 20041117