Bug 35931 - [painting] Annotations rendered when not necessary
Summary: [painting] Annotations rendered when not necessary
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: 3.2 M3   Edit
Assignee: Tom Hofmann CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks: 71994
  Show dependency tree
 
Reported: 2003-04-01 13:39 EST by Knut Radloff CLA
Modified: 2005-11-01 06:41 EST (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 Knut Radloff CLA 2003-04-01 13:39:27 EST
build R2.1

Every time I type a character all visible squiggly line annotations are 
rendered.
Since the AnnotationPainter already checks whether an annotation is visible it 
seems reasonable to check whether it is affected by a redraw request.
Noticed this while researching bug 32571.
Comment 1 Tod Creasey CLA 2005-03-07 11:57:14 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 2 Mike Wilson CLA 2005-04-21 13:37:02 EDT
Is this still happening? If so, it sounds like it's worth looking at as a potential source for typing 
performance problems on platforms with slower painting behavior (e.g. GTK, Mac). If not, PR should be 
closed.
Comment 3 Tobias Widmer CLA 2005-04-22 12:46:44 EDT
I agree that this should be fixed. My observations are the following:
- On editor activation, for each annotation in the model a single repaint is 
issued
- On every keystroke, for each annotation in the model there are 2 repaints
- If the mouse hovers over the annotation and a text hover is displayed, the 
annotation is repainted even if the hover did not intersect with the 
annotation at all

The situation is even worse after a reconcile pass. The entire set of 
annotations is exchanged, which issues a second repaint pass.

The fix would be to pass not only the GC, but the entire paint event to the 
AnnotationPainter#handleDrawRequest(GC) method in order to filter annotation 
repaints which are not inside the repaint region of the event.

These observations can be made by instrumenting the handleDrawRequest method
Comment 4 David Williams CLA 2005-06-29 16:46:42 EDT
I think this is still happening. 
Using 3.1. In our HTML editor, there have been bug reports of slow performance 
for some files, such as bug 71994 (where the person reporting said even basic 
text editor does not handle his "test file" well).

While investigating that, one cause (and frequent "use case") is for 
HTML files that have no, or few line seperators, so we end up with few lines, 
but some lines can be 10's of 1000's of characters long. There is an enormous 
amount of repaints being requested, which for short lines is done quidkly enough 
its not noticed, but for these very long lines really drags down performance. 
We have some workarounds in our linestyleevent listener (and quickly handle
repeated requests for the exact same info) but not all of the "paint process" is
so fast so is still unworkable. 

Comment 5 Tom Hofmann CLA 2005-10-20 11:31:11 EDT
This has been fixed right after M2 - AnnotationPainter now does the following:

- the paint region affected by the redraw request is translated into the
document region that needs repainting.

- any annotations with positions outside that region are not painted.

The performance improvements to line-based scrolling (Ctrl+UP/DOWN) is quite
obvious on my machine.

There are more optimization opportunities remaining:

- reconciling in the Java editor exchanges the entire set of annotations,
resulting in a huge annotation model change and redrawing all annotations (see
comment 3). I filed bug 113238 to track this issue.

- we don't use the horizontal clipping information yet. If a line intersects
with the clipping region, still all annotations on that (possibly long) line are
drawn (comment 4). I filed bug 113241 for this issue.

- when pruning annotations, still all annotations have to be iterated to find
out their offsets. We should investigate whether the benefits of having a range
index on annotations outweighs the cost of maintaining it (bug 113247).
Comment 6 Tobias Widmer CLA 2005-11-01 06:41:54 EST
Verified using I20051031-2000