Bug 320595 - [painting] "Show whitespace character" option makes the editor very slow on Linux
Summary: [painting] "Show whitespace character" option makes the editor very slow on L...
Status: CLOSED DUPLICATE of bug 434194
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.3.2   Edit
Hardware: PC Linux
: P1 major with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 416765 (view as bug list)
Depends on: 434194
Blocks:
  Show dependency tree
 
Reported: 2010-07-22 04:07 EDT by Martin Fleurke CLA
Modified: 2014-05-06 09:55 EDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Fleurke CLA 2010-07-22 04:07:45 EDT
Build Identifier: 20100617-1415

Enabling the option "Show whitespace character" makes the editor type slow on
Linux. The editor is normal responsive if this option is off.
Performance decreases even more  when you make the visible part of the editor larger (resize eclipse or the editor pane).
Typing outside php tags is normal, but within php-tags it can slow down to 1 char per second.
Bug 320135 is a similar problem, but then specific to Mac.

Reproducible: Always

Steps to Reproduce:
1.Enable "Show whitespace character"
2.Type anywhere between php-tags in the php-editor.
Comment 1 Zhongwei Zhao CLA 2010-08-05 03:11:53 EDT
what is your project size and your machine configuration?
I think php tags mean <?php ?> right?
I maximize the php editor,and type lots of charactors,and it sees normal,btw,my php project is very small!
Comment 2 Martin Fleurke CLA 2010-08-10 10:05:05 EDT
php tags mean <?php ?>

The project size is >1500 php files (and >400 js files). If I create a project with only 1 file, there is no notable speed loss.

I have a Intel Core2Duo E8400 @3GHz, 2G RAM running Ubuntu 10.04. Should be fast enough I'd say.
Comment 3 Zhongwei Zhao CLA 2010-08-10 19:44:42 EDT
Thanks for your information!I will check it later.
BTW,did you check it with other editor,for example java project with lots of java files?
Comment 4 Martin Fleurke CLA 2010-08-11 05:40:27 EDT
I haven't got a similar large Java project, but a smaller java project doesn't suffer the problem and non-php files in the large php project don't suffer either.
Comment 5 Dani Megert CLA 2010-08-11 05:44:37 EDT
Whitespace painting does in no way depend on the size of a project. It simply depends on the file shown in the editor.
Comment 6 Martin Fleurke CLA 2010-08-11 06:07:54 EDT
Hmm, I tested again the same file in small or large project, and indeed it does not matter. 
What matters is the amount of characters in display. So if you edit the same file on a position with a lot of blank lines it is faster than typing in a position with a lot of long lines. (I think this is why I had different results in a smaller project: I typed on a different position)
Comment 7 Zhongwei Zhao CLA 2010-08-11 20:40:34 EDT
But I have tested for lots of characters in display.Because you already said that in description.
Comment 8 Martin Fleurke CLA 2010-08-23 08:14:46 EDT
Note: the 'very slow' can be changed to 'relatively slow'. On my PC the performance deterioration was doubled by some bad video settings (I used Xinerama to rotate 1 monitor 90 degrees (NVidia card+drivers) instead of normal settings (twinView without rotation). Some things like scrolling and typing with 'show whitespace' enabled in Eclipse slowed down extremely. I have reverted to normal orientation and TwinView, and now scrolling is normal, and typing with 'show whitespace' enabled is still slow, but instead of 1 char/s I can type a couple of chars/sec in the worst case. (Still not fast enough).
Comment 9 Kris Pypen CLA 2012-09-10 18:22:59 EDT
This is still an issue in 4.2

The method WhitespaceCharacterPainter.paintControl is slow.

It's calling 3 slow methods for every visible character on each scroll step: 
* GC.getFontMetrics()
* GC.drawString
* StyledText.getLocationAtOffset

I think GC.getFontMetrics() can be cached, but maybe the whole Painter must be rewritten because not on every scroll everything must be repainted.

Some people may think it's slower on Mac, but that's because they use the trackpad or a mac mouse I think. These devices does a lot more scroll steps per second.

see line 229: http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.swt/Eclipse%20SWT/common/org/eclipse/swt/widgets/TypedListener.java?view=markup
and see line 498: http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.jface.text/src/org/eclipse/jface/text/WhitespaceCharacterPainter.java?view=markup
Comment 10 Keno Stix CLA 2013-09-16 06:45:07 EDT
*** Bug 416765 has been marked as a duplicate of this bug. ***
Comment 11 Jens Henrik Goebbert CLA 2013-12-11 17:05:25 EST
This is an important bugreport!

It is not fixed in Kepler 4.3.1 yet and gave me a real headache over weeks.
I can confirm that switching off "show whitespace character" made the editor usable again (I use eclipse-photran plugin for Fortran files).

Before this I had to restarted eclipse to get better scrolling-speed for a short time again => it made a difference how long eclipse was running.
Comment 12 Ed Merks CLA 2013-12-13 01:43:58 EST
Does it make sense that this bug is opened against PDT.  The description sounds like this would be an issue in any editor that uses the Eclipse text editor, so shouldn't this be opened against the platform?
Comment 13 Dawid Pakula CLA 2014-05-06 05:23:01 EDT
I'm moving it into platform text.

Most of PHP developers prefer spaces instead of tabs, and because each space is rendered separetly, php and any other editor will be typicaly 4x slower than editors with tabs. 

On big screens this is very painful.

In WhitespaceCharacterPainter:351 I see an information about painting problems. They probably have to be fixed.
Comment 14 Dani Megert CLA 2014-05-06 06:51:16 EDT
So far no comment indicated that it's also seen in other editors. So, before moving to the platform, please attach a text or Java file that demonstrates the problem. Also, attaching profiler information that shows where the time is really spent, helps more than guessing.
Comment 15 Martin Fleurke CLA 2014-05-06 08:00:27 EDT
Update from my side:

* php editor is still very slow if there is a lot of whitespace (Eclipse Juno, Ubuntu 13.10) visible.
* it does not matter if it is inside or outside php tags
* the default text-editor does not suffer from this problem.
Comment 16 Dani Megert CLA 2014-05-06 09:55:49 EDT

*** This bug has been marked as a duplicate of bug 434194 ***