public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: "ffileppo" <ffileppo@libero.it>
To: "java" <java@gcc.gnu.org>, 	"classpath" <classpath@gnu.org>
Subject: [GCJ] Performance of GUI applications on embedded systems
Date: Mon, 03 Nov 2008 07:38:00 -0000	[thread overview]
Message-ID: <K9QYIF$252662D59F01A2139690CBB67997D8AC@libero.it> (raw)

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);
  }
}


             reply	other threads:[~2008-11-03  7:38 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-03  7:38 ffileppo [this message]
2008-11-03 10:37 ` Andrew Haley
2008-11-03 12:02   ` Andrew Haley
2008-11-03 12:54     ` Andrew Haley
2008-11-03 13:02       ` Roman Kennke
2008-11-03 13:14         ` Andrew Haley
2008-11-03 15:46     ` Andrew Haley
2008-11-03 12:51 ffileppo
2008-11-03 14:53 ` Andrew Haley
2008-11-03 15:04   ` Andrew Haley
2008-11-05  8:24 ffileppo
2008-11-05  9:44 ` Andrew Haley
2008-11-05  9:45 ` Mark Wielaard
2008-11-05  9:50   ` Andrew Haley
2008-11-05 13:53 ffileppo
2008-11-05 14:07 ` Andrew Haley
2008-11-05 14:26   ` Andrew Haley
2008-11-06 13:40 ffileppo
2008-11-06 16:40 ` Andrew Haley
2008-11-06 17:02   ` Christian Thalinger
2008-11-07 11:04 ffileppo
2008-11-07 11:18 ` Andrew Haley
2008-11-07 18:56 ` Andrew Haley
2008-11-08 11:40   ` Andrew Haley
2008-11-08 12:47     ` Andrew Haley
2008-11-09  0:25       ` Andrew John Hughes
2008-11-09 10:11         ` Mark Wielaard
2008-11-09 13:55         ` Andrew Haley
2008-11-10  8:55 ffileppo
2008-11-10 10:20 ` Andrew Haley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='K9QYIF$252662D59F01A2139690CBB67997D8AC@libero.it' \
    --to=ffileppo@libero.it \
    --cc=classpath@gnu.org \
    --cc=java@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).