Bug 38937 - slow scrolling in java editor
Summary: slow scrolling in java editor
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.1   Edit
Hardware: PC Linux-GTK
: P3 major with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
: 46038 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-06-16 06:54 EDT by Adam Kiezun CLA
Modified: 2007-09-06 16:15 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Kiezun CLA 2003-06-16 06:54:42 EDT
20030611
scrolling in the java editor is a couple of times slower on gtk than on windows
which make the ide seem unresponsive

major for me - i get annoyed by it every time (i switched to linux recently)
Comment 1 Veronika Irvine CLA 2003-07-08 10:29:57 EDT
Steps to reproduce:

In Eclipse, open a fairly large java file and scroll.

If you have the SWT source in your eclipse workspace, an example of a large 
file is StyledText.java.
Comment 2 Steve Northover CLA 2003-07-11 15:00:14 EDT
VI to confirm that this doesn't happen in a plain StyledText that has the same 
amount of text and then move this PR to UI.
Comment 3 Adam Kiezun CLA 2003-07-14 05:28:56 EDT
if it were UI, then wouldn't we see the slowness everywhere, not just gtk?
i couldn't get my profiler to work on linux, if you have one that works i can 
take some performance traces
Comment 4 Adrian FILIP CLA 2003-08-15 10:33:27 EDT
Same here, I mean that gtk version on linux is very slow without > 512M RAM.
If you look on the forum you'll see that many people are in this situation.
I'm glad that somebody open a defect regarding this issue.
The gtk version is very slow compared to the win32 version, not only at 
scrolling large files, but this I guess is the most visible aspect.
From what I see there is no improvement in the latest versions.(3.0-M2)
Comment 5 Dani Megert CLA 2003-11-05 03:42:16 EST
*** Bug 46038 has been marked as a duplicate of this bug. ***
Comment 6 Felipe Heidrich CLA 2004-04-16 12:03:25 EDT
Please, retested this using the latest integration build, a lot of code has 
changed since this bug was opened.
Comment 7 Alexander Maryanovsky CLA 2004-07-28 11:38:18 EDT
This still occurs in 3.0.
One way the behaviour could be improved without actually improving painting 
performance is to avoid a paint for each keystroke when scrolling. Currently, if 
you press and hold UP, the editor will go through painting at each line position 
instead of skipping a few.

The current sequence of events (keep in mind that the key events come very 
quickly, 50 times a second on my setup):

* Actual UP key pressed (on the keyboard)
* Process key event
* Scroll one line up
* Paint
* Process key event
* Scroll one line up
* Paint
* ... (last 3 steps repeated many times)
* Actual UP key released (SWT still has queued key events)
* Process key event
* Scroll one line up (bad - the component keeps scrolling with no keys pressed).
* Paint 
* ... (last 3 steps repeated many times)
* The event queue is finally empty and the scrolling stops.


The desired sequence:

* Actual UP key pressed (on the keyboard)
* Process key event
* Scroll one line up (and schedule an asynchronous repaint)
* Process key event
* Scroll one line up (and schedule an asynchronous repaint, coalesced with the 
last one)
* Process key event
* Scroll one line up (and schedule an asynchronous repaint, coalesced with the 
last one)
* Paint
* Process key event
* Scroll one line up (and schedule an asynchronous repaint)
* ... (repeating)
* 
* Actual UP key released (Since SWT has been processing the key events very 
quickly, the queue is empty)
* Scrolling stops.

Comment 8 Billy Biggs CLA 2004-07-28 12:10:10 EDT
Thanks for posting the steps, especially the part about the keyboard repeat rate.

I was able to reproduce this problem by increasing the keyboard key repeat rate
up, but I had to set it pretty high in order to see the effect.  The default
keyboard repeat rate (at least under GNOME/RH9) was too slow to exhibit the
problem on my setup: scrolling never lagged behind the cursor.

Comparing with other editors on Linux, gedit and kate (even with syntax
highlighting) are both much faster than scrolling a large file
(WorkbenchPage.java) in the text editor on Eclipse (no syntax highlighting or
code folding).  Furthermore, they don't seem to skip lines, so I think there
may be a more fundamental problem here.
Comment 9 Tod Creasey CLA 2005-03-07 11:57:24 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 10 Veronika Irvine CLA 2005-04-14 11:48:31 EDT
Felipe, Can you profile this and see if there is any performance improvement 
that can be made for 3.1?
Comment 11 Mike Wilson CLA 2005-04-21 13:39:12 EDT
Felipe, did you get a chance to profile this yet?
Comment 12 Adam Kiezun CLA 2005-04-21 17:45:04 EDT
FWIW, scrolling in *Plain-Text* editor on *Linux-GTK* is fast. I see no slowness
there. I have a file of 38010477  bytes, or 67770 lines. Opening could be faster
maybe, but scrolling is good (using either the wheel or pgup/pgdown or the
scrollbar).
Comment 13 Felipe Heidrich CLA 2005-04-21 18:00:35 EDT
Billy is trying to improve the performace on Control.update() and/or 
Canvas.scroll(). These function are used when the StyledText scrolls: it 
updates area (make sure there is no outstanding paints), copy area, repaint 
the bottom (or top) line.

Other areas we can look at is improve the time to initialize and paint a line, 
improve the time to measure and place the caret. We already did a lot of work 
in these areas and right now mostly of the time is spent in update/scroll area.
Comment 14 Felipe Heidrich CLA 2005-04-25 18:51:51 EDT
StyledText has frameworks to do all kinds of work, action like line down, page 
down, etc are all implemented using this framework. The framework calls the 
same call multiple times. For example, for each line down it will call 
getClientArea() 3 times and getTextLayout() 5 times. It also does all kinds of 
unnecessary work and checks that would not be required during a line down.

So I reimplemented the action line down w/o using the framework (being as 
straightforward as possible), avoiding all unnecessary calls that the 
framework does. But it didn't improve the time at all (scroll line down 1800 
times in a file of 2000 unstyled lines). Turns out getClientArea() and 
getTextLayout() are very fast, the framework doesn't really affect performance.

Actually, roughly 11 sec out of 13 sec it took to run the test was used by 
Control#update().

I'm attempted to close this PR as duplicate of Bug 79894.
Comment 15 Etienne Lacombe CLA 2007-03-30 12:35:00 EDT
I have the same problem, on Windows, with Eclipse 3.3M6. None of the other developers I work with have the problem. When I press up, down, left or right arrow, it is slow - specifically, when I hold the key down to move to a specific line, area, etc. The CPU goes up to 100% if I move for about 10 lines up or down. 

My keyboard settings are at the max speed and repeat rate.

This never occurred on 3.2.1 and 3.3M5.
Comment 16 Etienne Lacombe CLA 2007-05-09 23:52:14 EDT
Just wanted to signify that the problem I was having with 3.3M6 which was a very slow refresh rate when scrolling and very slow cursor movement from left to right is now resolved since I downloaded and installed 3.3M7.
Comment 17 Felipe Heidrich CLA 2007-09-06 16:15:59 EDT
closing.
We have improved scrolling speed for GTK as much as we can.