public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Haley <aph@redhat.com>
To: ffileppo <ffileppo@libero.it>
Cc: java <java@gcc.gnu.org>, classpath <classpath@gnu.org>
Subject: Re: [GCJ] Performance of GUI applications on embedded systems
Date: Mon, 03 Nov 2008 12:54:00 -0000	[thread overview]
Message-ID: <490EF462.2060503@redhat.com> (raw)
In-Reply-To: <490EE83E.7080806@redhat.com>

Andrew Haley wrote:
> Andrew Haley wrote:
>> ffileppo wrote:
>>
>>> 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?
>> We can only speculate.
>>
>> oprofile is your friend.  If you can get oprofile working on your
>> target system, please use it and find out if it does what you need.
> 
> I did it.  The answer is appended.
> 
> The problem is that the program is spending almost all of the time
> generating stack traces, millions and millions of them.

And one reason for that is pointless class lookups in
the GTK peer code.

Look at this:

Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getKerning
(JNIEnv *env, jobject obj __attribute__((unused)), jint rightGlyph, jint leftGlyph, jlong fnt)
{
  ...

  cls = (*env)->FindClass (env, "java/awt/geom/Point2D$Double");
  method = (*env)->GetMethodID (env, cls, "<init>", "(DD)V");
  return (*env)->NewObjectA(env, cls, method, values);
}

Now, this method only returns a pair of points, and it would have been
trivial to pass a 2-element array into it, fill, with x and y, and
return the same array.  But no, we do a class lookup on
java/awt/geom/Point2D$Double and call its constructor with two
double values.

I don't know if this gross inefficiency in the GTK peer is the whole
cause of your pain, but it's a lot of it.

Andrew.

  reply	other threads:[~2008-11-03 12:54 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-03  7:38 ffileppo
2008-11-03 10:37 ` Andrew Haley
2008-11-03 12:02   ` Andrew Haley
2008-11-03 12:54     ` Andrew Haley [this message]
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=490EF462.2060503@redhat.com \
    --to=aph@redhat.com \
    --cc=classpath@gnu.org \
    --cc=ffileppo@libero.it \
    --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).