Community
Participate
Working Groups
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
Created attachment 19062 [details] Scrolling trace
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.
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.
Nothing I can in here. Closing.