This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Speed issue?
David St-Hilaire wrote:
Ok thanks guys!
I tried adding type declarations as you told me. Runtime passed from 25secs to
about 22 secs... I'll try later to run some native Java for the inner simulation
loop to see if it really makes a difference, but I probably won't be able to use
kawa with such a time diff... :(
It's not just primitive arithmetic, but also method calls.
A very useful pair of compiler options are:
--warn-undefined-variable --warn-invoke-unknown-method
I tried:
$ bin/kawa --main --warn-undefined-variable --warn-invoke-unknown-method
-C /tmp/Inv.scm
And I got a number of warnings like:
/tmp/Inv.scm:59:25: warning - no accessible method 'nextInt' in
java.lang.Object
This tell you that Kawa has to use reflection to invoke nextInt,
because it doesn't know the type of the argument. This will of
course be quite a bit slower!
Of course I don't have the umontreal.iro.lecuyer.rng.* classes;
many of the warnings may go away if you compile with all the
needed classes visible.
If you add declarations to get rid of these warnings, I suspect
you'll find that Kawa is about as fast as Java.
The options are also good for catching typos and other errors.
--
--Per Bothner
per@bothner.com http://per.bothner.com/