Bug 95102 - Pasting class body into new class is slow because of import generation [ccp]
Summary: Pasting class body into new class is slow because of import generation [ccp]
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.2   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2005-05-13 06:45 EDT by Tobias Widmer CLA
Modified: 2009-08-30 02:15 EDT (History)
1 user (show)

See Also:


Attachments
Trace (7.12 KB, application/x-zip-compressed)
2005-05-17 07:12 EDT, Tobias Widmer CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Widmer CLA 2005-05-13 06:45:29 EDT
I20050513-0010

Steps to reproduce:
- Enable update imports when pasting
- Copy the body of a large size class (eg. JavaEditor)
- Create a new class with no members
- Paste the body of the other class

-> Imports are generated slowly. It seems as every import is immediately 
applied to the document, thus triggering redraw. Paste should collect the 
import changes in an import edit and apply once
Comment 1 Martin Aeschlimann CLA 2005-05-13 10:15:16 EDT
only one edit is applied.
Comment 2 Dirk Baeumer CLA 2005-05-17 05:07:52 EDT
Tobias, do you have any concrete numbers here ?
Comment 3 Tobias Widmer CLA 2005-05-17 07:12:10 EDT
My measurements:

- Plugin Project with same dependencies as JDT UI
- New class DummyEditor
- Paste members of class JavaEditor

Applying the text edit takes 4.5 s
-> Trace shows that, although one edit is applied, the text viewer listens for 
every document change which causes the slow insertion

Attaching trace
Comment 4 Tobias Widmer CLA 2005-05-17 07:12:32 EDT
Created attachment 21251 [details]
Trace
Comment 5 Tobias Widmer CLA 2005-05-17 10:07:20 EDT
The problem also occurs when pasting without automatically generating 
immports. As soon as all organize import dialogs to solve ambiguos types have 
been closed and the text edit is applied to the cu, the described phenomenon 
happens.

However, for the scenario described here, more than one edit is generated. The 
method ImportsStructure#create(boolean, IProgressMonitor) generates a 
MultiTextEdit with InsertEdits as children for each of the imports to be 
generated. Since each one of these child edits triggers redrawing of the 
widget, it may be worth to start a seqeuential rewrite session or to generate 
only one edit in ImportsStructure
Comment 6 Dirk Baeumer CLA 2005-05-19 04:27:11 EDT
Martin, would it make sense to set the document into sequential rewrire mode here?
Comment 7 Dirk Baeumer CLA 2005-06-08 16:36:00 EDT
Not critical for 3.1. Should recondider in 3.2.
Comment 8 Denis Roy CLA 2009-08-30 02:15:09 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.