Dynamic class loading

Per Bothner bothner@cygnus.com
Sat May 1 16:21:00 GMT 1999

> I'm curious to hear what evidence and/or conjecture you use to
> make this point, ie. that JNI native methods would be (on average)
> slower than interpreting the same method.

If the method body just does some arithmetic calculation, without
accessing fields of Java objects, invoking Java methods, or
indexing into Java arrays, then compiled code will be faster.
But as soon as you need to actually access *data*, if you have to
call a JNI function to do it, you will lose, because you will get
the JNI overhead.  For example, to get a contents of a field
(even a field of `this'), you have to call the GetXXXField JNI
method.  This is likely to be substantially slower than just
executing a `getfield' bytecode instruction, especially if use a JIT.

	--Per Bothner
bothner@cygnus.com     http://www.cygnus.com/~bothner

More information about the Java mailing list