Bug 57495 - [formatting] Code Formatter Performance Problems
Summary: [formatting] Code Formatter Performance Problems
Status: RESOLVED DUPLICATE of bug 72319
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
: 57499 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-04-05 14:56 EDT by Chris McLaren CLA
Modified: 2005-10-11 07:34 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris McLaren CLA 2004-04-05 14:56:43 EDT
Using M8 on GTK. Accidentally performed Source->Format (java conventions) on a
large, previously unformatted class (WorkbenchWindow).

Two problems:

1. The operation, while taking a very long time, blocked the UI.

2. After it completed, I performed Edit->Undo and was surprised that the undo
operation took about the same length of time (?) Perhaps performance can be
improved under certain conditions if the the code formatter could consider
copying the text before the format starts and implement undo as a text replace
using the entire original text? (It is so slow to undo, I'm just guessing here
that it is doing the inverse of the format, operation by operation)
Comment 1 Dani Megert CLA 2004-04-27 04:53:17 EDT
please provide your formatter settings.
Comment 2 Chris McLaren CLA 2004-04-27 12:31:43 EDT
i used 'Java Conventions' with the default settings (as they appeared in m8)
Comment 3 Dani Megert CLA 2004-09-22 04:07:28 EDT
*** Bug 57499 has been marked as a duplicate of this bug. ***
Comment 4 Tod Creasey CLA 2005-03-07 11:57:16 EST
Adding my name to the cc list as we are now tracking performance issues more
closely. Please remove the performance keyword if this is not a performance bug.
Comment 5 Mike Wilson CLA 2005-04-21 14:29:19 EDT
I don't find formatting to take a long time any more. Even re-formatting all of StyledText.java on my 
Mac laptop took less than 20 seconds. However, the UI *is* still unresponsive during this time. Does it 
make sense to use the busyCursorWhile(...) support here?
Comment 6 Tom Hofmann CLA 2005-04-21 14:35:11 EDT
20 seconds seems long to me.

If you have comment formatting enabled, this may slow things down. I just
noticed that we copy the entire document in the comment formatter using
IDocument.get().
Comment 7 Mike Wilson CLA 2005-04-21 14:48:18 EDT
My test case was:
- open StyledText.java
- use find/replace dialog to replace all tabs with nothing (i.e. remove all tabs)
- use find/repace dialog to replace "if (" with "if              ("
- select all
- "Source" -> "Format"

This takes 18..20 seconds on my 1.33GHz G4 laptop.
Comment 8 Dani Megert CLA 2005-10-11 07:34:10 EDT

*** This bug has been marked as a duplicate of 72319 ***