Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8071306

GUI perfomance are very slow compared java 1.6.0_45

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 7, 8, 9
    • Fix Version/s: 9
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b68
    • CPU:
      x86_64
    • OS:
      windows_7

      Backports

        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.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                serb Sergey Bylokhov
                Reporter:
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: