Bug 88670 - StyledText scrolling spends most of its time setting top caret
Summary: StyledText scrolling spends most of its time setting top caret
Status: RESOLVED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2005-03-21 14:51 EST by Tod Creasey CLA
Modified: 2005-04-07 16:18 EDT (History)
1 user (show)

See Also:


Attachments
Scrolling trace (54.04 KB, text/html)
2005-03-21 14:52 EST, Tod Creasey CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.