JDK-8071306 : GUI perfomance are very slow compared java 1.6.0_45
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7,8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2015-01-21
  • Updated: 2015-09-29
  • Resolved: 2015-05-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u60Fixed 9 b68Fixed
Description
FULL PRODUCT VERSION :
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)

FULL OS VERSION :
Microsoft Windows [S��r��m 6.1.7601]

A DESCRIPTION OF THE PROBLEM :
multiple setEnable() method calls cause poor GUI performance and visibly slowness. But Actual problem caused by updateCursorImmediately() method call. If the component count is huge at a container In Java 1.6.0_45 method call result in under 1 second but in Java 1.8.0_25 It result in nearly 6 second.  Users are unsatistied by this situation. And We have couldn't migrate from 1.6 to 1.8.

THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try

THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try

REGRESSION.  Last worked in version 6u45

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
You can use the sample code the reproduce the performance problem

EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected Result is that process of Disabling 1000 JButton is under 1 second.
Actual Result  is that It's lasting 6 second. 
ERROR MESSAGES/STACK TRACES THAT OCCUR :
There is no error message.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.Component;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;

public class TestGUI extends JFrame implements ActionListener {

    private static final long serialVersionUID = 1L;

    public TestGUI() {
        initGUI();
    }

    public void actionPerformed(ActionEvent e) {
        String text;
        if(e.getActionCommand().equals("Enable-ALL")){
            enableAll();
            text= "Disable-ALL";
        }
        else{
            disableAll();
            text= "Enable-ALL";
        }
        ((JButton)e.getSource()).setText(text);
        ((JButton)e.getSource()).setEnabled(true);

    }


    private  void initGUI() {
        long m = System.currentTimeMillis();
        System.out.println("Initializing GUI");
        setTitle(System.getProperty("java.vendor") + " " + System.getProperty("java.version"));
        setLayout(new FlowLayout());

        JButton b = new JButton("Disable-ALL ");
        b.addActionListener(this);
        add(b);

        for (int i = 1; i < 10001; i++) {
            b = new JButton("Button " + i);
            add(b);
        }
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(600, 600);
        setVisible(true);
        m = System.currentTimeMillis() - m;
        System.out.println("GUI initialized in " + m + " ms");
    }

    private void disableAll() {
        long m = System.currentTimeMillis();
        System.out.println("Disabling");
        for (Component c : getContentPane().getComponents()) {
            c.setEnabled(false);
        }

        m = System.currentTimeMillis() - m;
        System.out.println("Disabled in " + m + " ms");
    }

    private void enableAll() {
        long m = System.currentTimeMillis();
        System.out.println("Enabling");
        for (Component c : getContentPane().getComponents()) {
            c.setEnabled(true);
            invalidate();
        }
        m = System.currentTimeMillis() - m;
        System.out.println("Enabled in " + m + " ms");
    }

    public static void main(String[] args) {

        EventQueue.invokeLater(new Runnable() {
            public void run() {
                System.out.println(System.getProperty("java.vendor") + " "
                        + System.getProperty("java.version"));
                new TestGUI();
            }
        });
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
I have no workaround.


Comments
Initial version of the fix: http://cr.openjdk.java.net/~serb/8071306/
27-04-2015

This is regression of JDK-6784816.(the fix for jdk6u12 was different from the fix in jdk7). The issue above is worsened because of JDK-6616323
23-01-2015

which release (7uN or 8uN) introduced that?
22-01-2015

On my system the difference is 20 sec vs 1 sec
22-01-2015

Sergey, please evaluate this issue. Thx!
22-01-2015

Nothing to do with hotspot - moved to client-libs -> awt
22-01-2015

Test result with JDK 6u29 : Sun Microsystems Inc. 1.6.0_29 Initializing GUI GUI initialized in 1278 ms Disabling Disabled in 4685 ms Enabling Enabled in 411 ms Disabling Disabled in 4541 ms Test result with JDK 8u25 : run: Oracle Corporation 1.8.0_25 Initializing GUI GUI initialized in 1086 ms Disabling Disabled in 2603 ms Enabling Enabled in 1583 ms Disabling Disabled in 9731 ms Enabling Enabled in 1495 ms Disabling Disabled in 9666 ms Enabling Enabled in 1513 ms Disabling Disabled in 9664 ms Test result with 8u40 ea : Oracle Corporation 1.8.0_40-ea Initializing GUI GUI initialized in 912 ms Disabling Disabled in 464 ms Enabling Enabled in 1091 ms Disabling Disabled in 7888 ms Enabling Enabled in 1103 ms Disabling Disabled in 7696 ms Enabling Enabled in 1219 ms Disabling Disabled in 8226 ms
22-01-2015