From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7206 invoked by alias); 3 Nov 2008 12:54:46 -0000 Received: (qmail 7190 invoked by uid 22791); 3 Nov 2008 12:54:45 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 03 Nov 2008 12:53:59 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id mA3Crvsn028346; Mon, 3 Nov 2008 07:53:57 -0500 Received: from zebedee.pink (vpn-12-82.rdu.redhat.com [10.11.12.82]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id mA3CrslE021115; Mon, 3 Nov 2008 07:53:55 -0500 Message-ID: <490EF462.2060503@redhat.com> Date: Mon, 03 Nov 2008 12:54:00 -0000 From: Andrew Haley User-Agent: Thunderbird 2.0.0.17 (X11/20080914) MIME-Version: 1.0 To: ffileppo CC: java , classpath Subject: Re: [GCJ] Performance of GUI applications on embedded systems References: <490ED42E.3000701@redhat.com> <490EE83E.7080806@redhat.com> In-Reply-To: <490EE83E.7080806@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2008-11/txt/msg00008.txt.bz2 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, "", "(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.