This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: performance


> >  - Sun's JDK (which version)
> > OR
> >  - GNU's gcj (which version)
> 
> I haven't done any tests, but have been very happy with tuned 
> Kawa code.
> Sometimes we'll add typing information for our inner loops, 
> which generates faster code.  We also use define-namespace 
> heavily to avoid the hassle of add types while avoiding reflection.

We use the same approach at NuEcho. But let me give you a more concrete 
example of code optimization we did a few months ago.

I had a search algorithm implemented in continuation-passing style with the
--full-tailcalls option enabled. Of course, general tail calls are not
really efficient in Kawa compared to plain Java method calls. The algorithm
was desperately slow (the search space was huge and we had to search for all
solutions).

I compiled the same code (with a few type annotations removed) with Chicken,
which generates C code. The algorithm was two order of magnitudes faster. 

But I was not going to give up and throw away all my Kawa development. I
rewrote the algorithm using classes (thus mainly scripting Java in Scheme),
used define-namespace a lot and typed everything I could. [Of course, I lost
the elegance and succintness of the first solution...]

The result? The new algorithm was 3 times faster than the Chicken compiled
version! It takes only a few seconds to complete, instead of the original 20
minutes.

In the light of this experience, I would say that carefully written Kawa
code run using Java Hotspot can clearly compete with Scheme code compiled to
C.


Regards,
Dominique Boucher, Ph.D.
Lead Developer
Nü Écho Inc
www.nuecho.com
Tél: (514) 861-3246 x 231
 
 



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]