[GCJ] Performance of GUI applications on embedded systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I've been investigating about performance of java code compiled with gcj on embedded systems.
In particular I'm interested in testing AWT/SWING application using GTK/Xorg as graphical backend
(this is the only viable solution since QT peers are not well supported).

The embedded device I've been using for testing is a PXA270 processor (armv5te) equipped with 128Mb Ram;
running linux kernel 2.6.24 and using libgcj.so.10. GTK peers are running on Xorg, using matchbox
as window manager. The crosscompiler on my host is gcc 4.4.

During my tests I've noticed that java code using AWT/SWING (for example the test case attached at the end)
with GTK peer cause a very high load on the cpu.
Furthermore the applications take a lot of time to load and also the UI responsiveness is very slow.
Using "top" I can see that CPU is always at 100% during start up (it takes about 2 minutes 
to get the application starting, Ram usage is ok).

I've also noticed that using optimizations (-O2, -O3...) does not help with graphical performance.

[On the same device, running WinCE and a commerical JVM (CrEme), applications have extremely better
graphical performance]

>From my experience with this particual embedded system I can say that gcj has very high performance 
when dealing with non-gui tasks (e.g. array sorting) compared with most of JVMs but gui 
performance are very poor.

I would like to ask your opinion about the slowness of gui applications in my setup,
and also about viable solutions to improve this issue.
What do you think is the bottleneck?

-- libgcj itself?
-- GTK library / GTK peer implementation in classpath?
-- something dealing with Xorg?

Your feedback and ideas will be very appreciated.


Thank you,
Francesco


Test case:

import java.awt.BorderLayout;
import javax.swing.DefaultListModel;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.Timer;
import java.awt.event.*;


public class MainPanel extends JPanel implements ListSelectionListener {

  static final int NUM_ROWS = 500;

  JList list;
  JLabel lblSelection; 
  DefaultListModel listModel;

  int startRow = 0;
  long startTime = 0;


javax.swing.Timer t = new javax.swing.Timer(0, new ActionListener() {
     public void actionPerformed(ActionEvent e) {
     long deltaTime = System.currentTimeMillis() - startTime;
     for (int i=startRow; i<NUM_ROWS; i++) {
     	listModel.set(i, ""+deltaTime);
     }

     startRow++;
     startTime = System.currentTimeMillis();

     }
});

public MainPanel() {
    super(new BorderLayout());

    listModel = new DefaultListModel();

    for (int i=0; i<NUM_ROWS; i++) {
    	listModel.addElement("Element "+i);
    }

    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setSelectedIndex(0);
    list.addListSelectionListener(this);
    list.setVisibleRowCount(5);

    JScrollPane listScrollPane = new JScrollPane(list);
    lblSelection = new JLabel(" ");
    add(lblSelection, BorderLayout.SOUTH);
    add(listScrollPane, BorderLayout.CENTER);
    t.start();
    startTime = System.currentTimeMillis();

}

public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting() == false) {
      if (list.getSelectedIndex() == -1) {
        lblSelection.setText("");
      } else {
        lblSelection.setText("Item selected: "+list.getSelectedIndex());
      }
    }
}

public static void main(String[] args) {
    JFrame frame = new JFrame("TestUI #1");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JComponent newContentPane = new MainPanel();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);
    frame.setBounds(10, 10, 500, 400); 
    frame.setVisible(true);
  }
}





[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux