|
Replies:
4
-
Last Post:
Nov 4, 2008 12:30 PM
by: mikaelgrev
|
|
|
|
|
|
|
Resizing JFrame is Sluggish on 1.6.0_10 under (at least) Vista
Posted:
Oct 29, 2008 1:37 PM
|
|
|
Hello,
My JFrame takes about 10-30 ms to repaint. Yet on Vista and u10 the resizing of the JFrame is very sluggish. The window decorations themselves are updated nice and fast, but the content doesn't keep up at all. If I continuously resize the window it can be several seconds until the content of the window is updated.
Now for something that is harder to explain, but I'll try.. If I keep resizing the window in the smaller sizes (like below 200x200 pixels) the update rate is getting better and I can resize the window at larger sizes with decent update frequencies.. For a while.. But after a few seconds with resizing in the larger sizes (like 1000x800) the update rate goes down again and the content keeps lagging as bad as it did before.
I guess there's some algo that repaints the content depending on how long time the last couple of repaints took? Well, the problem is that that algo seems to be very broken in 1.6.0_10... If I run the same test app in 1.6.0_07 everything works fine.. Same on the Mac, which is by far the platform that feels fastest, even thought the actual painting takes longer...
Now, this is NOT because of the actual painting takes time. I have tested with just a small fillRect and the result is basically the same.
The problem here is that u10 should be faster (and some of the gfx is now really fast, kudos Swing/Java2D-guys!) but the GUI now feels very sluggish due to this "bug".
So... Does anyone know how to increase or force the update rate of the content or is this a plain bug that is in serious need to get fixed?
I am using a Macbook Pro 2,4GHz. 4GB and 1920x1200 + an external 30" Cinema Display. But the painting time is as I mentioned not really a factor here and the same happens on both displays.
Here is the simple test code that shows the problem. As you can see there's nothing funny going on...
import javax.swing.*;
import java.awt.*;
public class FrameUpdateTest
{
private final JFrame mainWindow = new JFrame();
private void launch()
{
mainWindow.getContentPane().setBackground(Color.WHITE);
mainWindow.setSize(1000, 800);
mainWindow.setLocationRelativeTo(null);
mainWindow.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
mainWindow.setVisible(true);
}
public static void main(String[] args)
{
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new FrameUpdateTest().launch();
}
});
}
}
Cheers, Mikael Grev
|
|
|
|
|
|
|
Re: Resizing JFrame is Sluggish on 1.6.0_10 under (at least) Vista
Posted:
Oct 30, 2008 11:10 PM
in response to: mikaelgrev
|
|
|
Likely due to the d3d pipeline. Try disabling it - typically resizing becomes much faster.
The reason is that when you resize we need to recreate a bunch of native d3d resources, which must happen on a toolkit thread synchronously, and that takes time, and it becomes noticeable with "live resize" where we respond to every frame size change.
Basically, the reisizing operations aren't done very efficiently, but we (both awt and 2d) never took the time to address this. It's also a rather fragile area, where it's easy to introduce behavior regressions.
Dmitri
|
|
|
|
|
|
|
|
Re: Resizing JFrame is Sluggish on 1.6.0_10 under (at least) Vista
Posted:
Oct 31, 2008 1:38 AM
in response to: trembovetski
|
|
|
Dmitri,
I don't know what to say... Vista has gone from being promising to a disaster when it comes to performance. This combined with the fact that if you turn on translucent pixels the whole frame will be repainted for every little local repaint makes creating anything that looks cool and 2008 is out of the question.
The funny thing is that everything is working 100% and fast on Mac 1.6.0_07...
|
|
|
|
|
|
|
|
Re: Resizing JFrame is Sluggish on 1.6.0_10 under (at least) Vista
Posted:
Nov 4, 2008 12:30 PM
in response to: rexguo
|
|
|
Thanks Rex,
I will check it out.
|
|
|
|
|