Bug 15210 - on-the-fly check for errors should wait until you stop typing
Summary: on-the-fly check for errors should wait until you stop typing
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P2 major (vote)
Target Milestone: ---   Edit
Assignee: Kai-Uwe Maetzel CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2002-05-03 12:11 EDT by Scott Rutledge CLA
Modified: 2002-09-04 07:42 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Rutledge CLA 2002-05-03 12:11:32 EDT
Currently, the on-the-fly error checker runs after every keystroke. This makes typing horribly 
slow when dealing with large files (>1000 lines), and I usually end up having to disable it.

It 
would be better if the checker waited for me to stop typing before running. This would be good for 
two reasons: better performance, and I don't care about errors while I'm typing (I'm not done the 
statement yet!). This would be done by starting a reseting a timer after every keystroke, and only 
running the checker once the timer fires. Preferrably the interval of the timer would be user 
definable.

This is how JBuilder does it, and I found it to work quite well.
Comment 1 Erich Gamma CLA 2002-05-04 08:20:19 EDT
In 20020502 the editor cannot fully keep up with typing in larger CUs when 
temporary problems are enabled. The test case used was PackageExplorerPart.java 
on my TP600X. 

Experimented with increasing the reconciling delay to 1000ms with no perceived 
performance improvements. 

Comment 2 Kai-Uwe Maetzel CLA 2002-05-09 07:30:32 EDT
Error detection does not start if the user types. When stopping it starts after 
a delay of 500ms. If the user starts typing, any running error detection is 
canceled. Build 20020508. 
Comment 3 Scott Rutledge CLA 2002-05-10 13:28:41 EDT
Editing large files in build 0510 still causes 100% CPU utilization while typing.
Comment 4 Kai-Uwe Maetzel CLA 2002-05-10 13:58:16 EDT
What is your concrete scenerio? Typing in StyledText.java (8000 loc) having all 
import statements removed (> 1000 errors) causes an average CPU load of 13%. 
There are short peaks of almost 100% when all temporary problem annotations are 
set, 500ms after you stop typing.
Comment 5 Scott Rutledge CLA 2002-05-10 15:05:21 EDT
I've tried with several files, ranging from 1000 to over 2000 lines. The number of errors doesn't 
have a percievable impact. It does indeed seem to wait 500ms before processing, but it also seems 
like the timer isn't reseting when I continue to type. I cannot release the concrete file, but I can 
reproduce this on any number of large files.

Updated report to specify this is on Windows 
2000.
Comment 6 Erich Gamma CLA 2002-05-11 18:04:00 EDT
I observe the same problem in the PackageExplorerPart scenario on my TP. The 
CPU is up to 100% even when I continue typing and the reconciling should have 
been preempted. 
Comment 7 John Arthorne CLA 2002-05-21 15:07:39 EDT
Using build 20020521 (1pm)

It seems to be the "Synchronize outline selection on cursor move" preference 
that kills the performance. If I turn that off, CPU usage hovers around 30% 
while typing.  If I turn it on, it hovers around 100% while typing (and the 
cursor can't keep up as I type).  This is on a 1.4Ghz PIV with 512MB RAM.
Comment 8 Dirk Hollweg CLA 2002-05-22 15:26:33 EDT
This issue is still present in the F1 build.
Even when i switch off the outline synchronization.

Tested with W2k and JDK1.4 and several java files with
a length of more than 2500 lines.
Comment 9 Erich Gamma CLA 2002-05-23 05:50:31 EDT
The reconciling is now pre-emptive but there are some scenarios where a 
reconcile is triggered in the UI thread:
* "synchronize outline selection on cursor move" calls getElementAt.
  Workaround disable the preference close and reopen the editor

* the text hover can kick in and trigger a reconcile. 
  Workaround is to disable the text hover.

* the breakpoint action triggers an unneeded reconcile
  on selection changes (see 17162) 
Comment 10 Kai-Uwe Maetzel CLA 2002-05-27 10:55:17 EDT
synchronizeOutlinePageSelection in the compilation unit editor no longer 
reconciles the compilation unit. If reconciling would be necessary, the method 
is a noop. This is ok as the reconciler will run or is about to run and thus 
all reconciling participants will be called in the near future.

The text hover infrastructure has been changed to compute the hover information 
in a separate dedicated thread.
Comment 11 Jose M Beleta CLA 2002-05-29 12:53:44 EDT
In F1 still slow even if "synchronize outline selection on cursor move" 
and "text hover" are off. Now some times when typing cr there are several 
seconds delays.
Comment 12 Dan Berindei CLA 2002-05-29 13:57:53 EDT
In build 20020528 I don't see any delays in the editor if I turn off 
reconciling and text hovers. If not, I still get some delays, especially when 
working with blocks of text (indenting, pasting).
Comment 13 Jose M Beleta CLA 2002-05-29 17:02:30 EDT
After starting a new Eclipse (F1) session things go better.
Comment 14 Kai-Uwe Maetzel CLA 2002-05-31 17:07:07 EDT
Further changes for F2:
- text hovering changed so that the hover only gets reactivated when leaving 
its previous hover region
- more strict cancellation of found temporary problems
- not directly related to typing: (shifting, commenting, replace) now work on a 
special optimized code store

Overall, typing delays have been perceivably reduced by avoiding any 
significant work in the UI thread. There are still problems with the 
cancellation behavior of the Java reconciler. I.e, its resonse time to 
cancellation requests is too long.
Comment 15 Scott Rutledge CLA 2002-06-02 23:07:13 EDT
Performance is much better now.

There are still two operations I've found that are 
problematic: Block indenting/unindenting, and commenting/uncommenting. When these 
operation are performed repeatedly (ie: holding down the hotkeys), the editor doesn't repaint 
until you release the key(s). This is in build 0602.

Other than that (which is a fairly rare 
case), things are looking much better.
Comment 16 Kai-Uwe Maetzel CLA 2002-09-04 07:42:38 EDT
Closed. Remaining issues in #23149.