Skip to main content

Extremely bad mousewheel scrolling performance on Mustang

10 replies [Last post]
plethora
Offline
Joined: 2005-06-30

I'm running IntelliJ IDEA on Mustang.

A subset of users (myself included) experience extremely bad mousewheel scrolling performance, but only when running on Java 6. It does not seem to be affected by specific hardware (I've read reports mentioning both ATI and NVidia cards). Neither does the presence/absence of Microsoft IntelliPoint make a difference.

My platform is Windows 2000 running JRE 1.6.0_02, however it seems that the same (or very a similar) problem manifests on Linux.

DirectDraw pipeline is disabled. Without changing any of the other external factors, it's very easy to observe the problem by switching between JRE 1.5 and JRE 1.6.

In some situations, it takes more than 10 seconds (!) of 100% CPU load to consume all the mousewheel scrolling events.

During these periods, one thread from the JVM process has >90% CPU load (reported as 50/50 kernel/used by SysInternals ProcessExplorer).

Native stack of this busy thread looks like:
----
ntoskrnl.exe+0x68d43
win32k.sys+0xb14e2
win32k.sys+0xde9e4
ntoskrnl.exe+0x65024
GDI32.dll+0x322db
awt.dll+0xe71c1
jvm.dll+0xc06bd
----

I've searched the Sun Bug Database without any results. Is this a known problem? What can I do to provide more information?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Jim Graham

Just a guess - perhaps the mousewheel scrolling forces an immediate
repaint whereas regular scrolling batches them? Batching can hide a
number of "slow, but not achingly slow, repaint" sins.

...jim

(Not a Swing engineer and sending this remotely so I can't go
investigate the hypothesis myself...)

java2d@JAVADESKTOP.ORG wrote:
> Ok, but it seems that regular scrolling is very fast.
> So I'm wondering why it only affects mousewheel scrolling.
> [Message sent by forum member 'plethora' (plethora)]

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

plethora
Offline
Joined: 2005-06-30

Jim, that is indeed the suspicion that I get from all this.

Additional comments from Maxim Mossienko (one of the IntelliJ developers):
---
It scrolls by small amounts too often.
I see interesting piece of code in JDK 6 sources (BasicScrollPaneUI:876)
// Check if we should use the visibleRect trick
Object fastWheelScroll = toScroll.getClientProperty(
"JScrollBar.fastWheelScrolling");
if (Boolean.TRUE == fastWheelScroll &&
comp instanceof Scrollable) { ... }
---
Relevant issue in Java bug DB seems to be http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5078454
---

Dmitri Trembovetski

Hello,

Did you try enabling hw acceleration?
(removing -Dsun.java2d.noddraw=true in their config).
Wouldn't necessarily help, but worth trying.

Another thing to try - turn off the Swing's gray rect fix:
-Dswing.bufferPerWindow=false

Thanks,
Dmitri

java2d@JAVADESKTOP.ORG wrote:
> I'm running IntelliJ IDEA on Mustang.
>
> A subset of users (myself included) experience extremely bad mousewheel scrolling performance, but only when running on Java 6. It does not seem to be affected by specific hardware (I've read reports mentioning both ATI and NVidia cards). Neither does the presence/absence of Microsoft IntelliPoint make a difference.
>
> My platform is Windows 2000 running JRE 1.6.0_02, however it seems that the same (or very a similar) problem manifests on Linux.
>
> DirectDraw pipeline is disabled. Without changing any of the other external factors, it's very easy to observe the problem by switching between JRE 1.5 and JRE 1.6.
>
> In some situations, it takes more than 10 seconds (!) of 100% CPU load to consume all the mousewheel scrolling events.
>
> During these periods, one thread from the JVM process has >90% CPU load (reported as 50/50 kernel/used by SysInternals ProcessExplorer).
>
> Native stack of this busy thread looks like:
> ----
> ntoskrnl.exe+0x68d43
> win32k.sys+0xb14e2
> win32k.sys+0xde9e4
> ntoskrnl.exe+0x65024
> GDI32.dll+0x322db
> awt.dll+0xe71c1
> jvm.dll+0xc06bd
> ----
>
> I've searched the Sun Bug Database without any results. Is this a known problem? What can I do to provide more information?
> [Message sent by forum member 'plethora' (plethora)]
>
> http://forums.java.net/jive/thread.jspa?messageID=236212
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

plethora
Offline
Joined: 2005-06-30

Dmitry,

I have tried enabling Java2D DirectDraw pipeline. Results were a mixed bag - in some cases it seems to help, in other cases not at all.

I have tried your second suggestion, and so far it seems to work! (at least in my configuration).

I am not very familiar with Java2D acceleration, but
-Was the 'grey rect' fix introduced in Mustang? That would explain why the problem does not manifest on JRE 1.5
-IDEA opens a new top-level frame for each open project. Does the 'grey-rect' fix perhaps (try to) allocate VRAM for each non-foreground frame - and because of that remaining VRAM amount may get quite small, slowing down drawing operations?

I have not tested this fully yet. But I will do so, and report the results here.

For now: thanks for your quick feedback.

Taras

Dmitri Trembovetski

Hi Taras,

java2d@JAVADESKTOP.ORG wrote:
> Dmitry,
>
> I have tried enabling Java2D DirectDraw pipeline. Results were a mixed bag - in some cases it seems to help, in other cases not at all.

OK.
Not really relevant to the discussion, but one thing is that
with the hw acceleration unconditionally disabled IntelliJ
will miss the new fully hw-accelerated Direct3D pipeline
to be introduced soon in 6 update release.

> I have tried your second suggestion, and so far it seems to work! (at least in my configuration).
>
> I am not very familiar with Java2D acceleration, but
> -Was the 'grey rect' fix introduced in Mustang? That would explain why the problem does not manifest on JRE 1.5

Yes, the 'gray rect' fix was introduced in Mustang.

The difference between 5.0 and 6.0 (with respect to the gray
rect fix) is that in 5.0 the scrolling happens on the screen:
first a copyArea is done on the screen surface, then Swing
repaints the exposed area to the back-buffer (or, rather,
a scratch buffer), which is then copied to the screen.

In 6.0 with the gray rect fix it all happens in the back-buffer:
both the copyArea and the repainting of the newly exposed
area. Then the back-buffer is copied to the screen.

With HW acceleration disabled this back-buffer is just a
BufferedImage, so copyArea operation for large regions
may be slower than on-screen scroll operation we had
in 5.0 (which was handled through GDI and thus was hw
accelerated in most cases).

And a copy from the back-buffer to the screen - and such
a copy after a large scroll could be pretty big - (which is
handled through our GDI blit loops) could be rather slow in
some cases like if the dimensions of the image being copied
are not dword aligned (scan line is not a multiple of 4).
In this latter case the blit happens scan line by scan line,
which is slow (I think there's a bug filed on that).

> -IDEA opens a new top-level frame for each open project. Does the 'grey-rect' fix perhaps (try to) allocate VRAM for each non-foreground frame - and because of that remaining VRAM amount may get quite small, slowing down drawing operations?

I don't think that's a problem - especially since you're
having issues even with hw acceleration disabled.

Thanks,
Dmitri

> I have not tested this fully yet. But I will do so, and report the results here.
>
> For now: thanks for your quick feedback.
>
> Taras
> [Message sent by forum member 'plethora' (plethora)]
>
> http://forums.java.net/jive/thread.jspa?messageID=236246
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

plethora
Offline
Joined: 2005-06-30

Dmitry,

After running for a day with the "grey rect fix" disabled, I can confirm that it solves my problem.

Is there anything I can do to diagnose why the "grey rect fix" causes such extremely bad mousewheel scrolling performance on my system?

Thanks for your help,

Taras

Dmitri Trembovetski

Hi Taras,

I believe I explained the cause in my other message (attached).

To sum it up, copying large image from system memory to the
screen using our GDI blit loops can be slow in some cases
depending on the dimensions of the image.

Thanks,
Dmitri

java2d@JAVADESKTOP.ORG wrote:
> Dmitry,
>
> After running for a day with the "grey rect fix" disabled, I can confirm that it solves my problem.
>
> Is there anything I can do to diagnose why the "grey rect fix" causes such extremely bad mousewheel scrolling performance on my system?
>
> Thanks for your help,
>
> Taras
> [Message sent by forum member 'plethora' (plethora)]
>
> http://forums.java.net/jive/thread.jspa?messageID=236447
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[email.eml]

plethora
Offline
Joined: 2005-06-30

Ok, but it seems that regular scrolling is very fast.
So I'm wondering why it only affects mousewheel scrolling.

Dmitri Trembovetski

java2d@JAVADESKTOP.ORG wrote:
> Ok, but it seems that regular scrolling is very fast.
> So I'm wondering why it only affects mousewheel scrolling.

Ah! I missed that bit somehow.

I'm trying to reproduce this now. How do I make Intellij
to use jdk6?

Dmitri

> [Message sent by forum member 'plethora' (plethora)]
>
> http://forums.java.net/jive/thread.jspa?messageID=236488
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Dmitri Trembovetski

OK, I've tried IJ 6.0 on 6u2 and dind't see any issues
with scrolling, mousewheel or otherwise.

I do have a beefy machine, though.

Thanks,
Dmitri

Dmitri Trembovetski wrote:
> java2d@JAVADESKTOP.ORG wrote:
>> Ok, but it seems that regular scrolling is very fast.
>> So I'm wondering why it only affects mousewheel scrolling.
>
> Ah! I missed that bit somehow.
>
> I'm trying to reproduce this now. How do I make Intellij
> to use jdk6?

>
> Dmitri
>
>
>> [Message sent by forum member 'plethora' (plethora)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=236488
>>
>> ===========================================================================
>>
>> To unsubscribe, send email to listserv@java.sun.com and include in the
>> body
>> of the message "signoff JAVA2D-INTEREST". For general help, send
>> email to
>> listserv@java.sun.com and include in the body of the message "help".
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".