If text is set to be antialiased scrolling in jEdit becomes significatly slow and cpu utilization jumps to 100%.
Everything was tested with clear .jedit directory and all plugins disabled (first time from plugin manager, then with -noplugins).
This doesn't occur with no anti aliasing and subpixel hinting. Disabling fractional font metrics doesn't make any change as all other setting in Text Area settings.
OS Archlinux current. Sun's java 1.6 u11. Architecture is i686.
svn diff for jEdit/trunk r14703
If this didn't happen on 4.3pre15, it is likely caused by removal of
FastRepaintManager.
http://jedit.svn.sourceforge.net/jedit/?view=rev&rev=13533
While I can't reproduce the serious performance problem on my machine
(Windows XP + JDK 6u11), jProfiler shows that layoutGlyphVector() is
consuming much CPU. So I made a experimental patch to introduce a cache
of GlyphVector instances.
Could someone please test the patch?
File Added: cache_GlyphVector.patch
This patch does correct the problem.
Without: laggy during heavy scrolling using 100% of one core
With: smooth during heavy scrolling using around 40% of one core
on Ubuntu with Sun java 1.6.0_10
jvisualvm cpu profiling comparison while scrolling
Forget my last comment, I probably ended using the wrong version when I verified.
Sorry about that.
I attached a quick jvisualvm profile difference between trunk r14663 and 4.3pre15 while scrolling.
Hope this gives a hint.
File Added: jvisualvm_pre15vsTrunk.png
I've just tested it and it may be a bit faster, but compared to the other settings (none/subpixel) it's still terribly slow.
It's possible that it's more visible on my computer because it's quite old (Pentium4 northwood @2GHz, graphics Nvidia 6200LE (drivers 180.35)).
If I can do some testing to help you fix it, I'll be glad to do it (if it's possible). Just ask.
Comparing the reports and my local profiling, I remembered that I have a
JVM option "-Dsun.java2d.opengl=true" in my environment.
http://java.sun.com/javase/6/docs/technotes/guides/2d/flags.html#opengl
This option seems to move the bottleneck from painting to
layoutGlyphVector(). Thus, my patch works much better with this option.
Could you please test the performance with this option? (and, with both
this option and my patch?)
I`ve just tried to start jEdit with -Dsun.java2d.opengl=true option - nothing renders except of window border + title.
Windows Vista 32bit + jEdit rev.14407 + JDK 1.6u11
Thanks, using OpenGL helped me.
current svn without the patch – scrolling as fast again with cpu utilization around 30% (exactly it was 28%-31%)
current svn with your patch – scrolling is fast, CPU utilization varies from 8% to 35%, most of the time it was less than 15%)
voituk, does anything else using GL work for you? If not, it might be a problem with your video driver.
Alan,
just tried few game from java2k contest - works fine.
Except of jEdit. :(
Anyway, i don`t think that it is common problem - seems like problems related to my laptop or my OS.
voituk,
If you have nVidia graphics card, you should try their latest beta release. Quote from the changelog:
"Fixed a problem that could cause Xid errors and display corruption in certain cases when OpenGL is used to render to redirected windows, for example when Java2D is used with the -Dsun.java2d.opengl=true option."
I did a dichotomic revert on the trunk to find the source of this problem.
The problem starts when updating to revision 13533 or higher.
This fast repaint manager did seem to improve something after all.
This bug is really more noticeable on my ubuntu machine (especially when there is a lot of text on the screen).
On windows I can operate with 4.3r17 without noticing it.
I think perhaps we need to revert the change which removes the FastRepaintManager and make it an option one can switch on/off, don't you agree Kazutoshi?
That would be rally nice.
Anyway, I've noticed that current svn behaves much better than pre16. The cpu usage is still high, but the scrolling is more flawless.
Seems you're right. I've 6u12 installed now.
Closing because: 1) it was caused by a bug in java 6u11 which has terribly slow font rendering and
2) -Dsun.java2d.opengl=true makes it behave better (lower CPU utilization on 6u12 and fixes it with 6u11)
See this post for the last 2 comments.
http://sf.net/mailarchive/message.php?msg_name=49E8BA70.4090102%40f2.dion.ne.jp