Re: [GCJ] Performance of GUI applications on embedded systems

Roman Kennke <[email protected]>
Newsgroups gmane.comp.gcc.java.devel,gmane.comp.java.classpath.devel
Message-ID <1225717239.6168.8.camel@moonlight>
Hi,

> > 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.

Or we could cache the MIDs and FIDs, like is recommended in all good JNI
books.

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-48
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.