Bug 88670

Summary: StyledText scrolling spends most of its time setting top caret
Product: [Eclipse Project] Platform Reporter: Tod Creasey <Tod_Creasey>
Component: SWTAssignee: Felipe Heidrich <eclipse.felipe>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: steve_northover
Version: 3.1Keywords: performance
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Scrolling trace none

Description Tod Creasey CLA 2005-03-21 14:51:22 EST
20050315

When you scroll a large scrolled text quite a bit of time is spent calculating the
top index.

STEPS
1) Open StyledText.java
2) Starting at the top of the editor select the scroll bar and scroll to the bottom

Optimize It trace to follow
Comment 1 Tod Creasey CLA 2005-03-21 14:52:10 EST
Created attachment 19062 [details]
Scrolling trace
Comment 2 Felipe Heidrich CLA 2005-03-21 17:16:25 EST
When the top index changes the StyledText needs update the horizontal 
scrollbar. In order to do that it needs to know the width of all visible 
lines. The new lines at bottom (supposing you are scrolling from the top to 
bottom) are created and initialized during this process. The creation of these 
new lines is what is taking time.

Even if you comment out all the code that is setting the scrollbar it won't 
improve the performance, it will only change the place where the time is 
spent. Instead of spending time creating lines during the scrolling the 
process will spend time creating lines during the paint.

NOTE: StyledText caches the visible lines. The time used to created & 
initialized a line when it becomes visible is necessary.
NOTE: We already put a lot of effort to optimize the time to create and 
initialize lines.
Comment 3 Veronika Irvine CLA 2005-03-22 13:07:18 EST
Felipe, if there is nothing more that can be optimized, maybe this bug should 
be closed.  Perhaps take another look just to be sure first.
Comment 4 Felipe Heidrich CLA 2005-04-07 16:18:45 EDT
Nothing I can in here. Closing.