On Sun, Feb 09, 2003 at 04:56:28PM -0500, Dave Keller wrote: > > >This is why I think i have alot of reluctance to move to Java; C is by far > >my prefered strongly-typed, "non-scripting" language. But I am a > >dinosaur... > > > > > Nothing wrong with that, C is an excellent language and there is still > plenty of C development going on. If C is the right tool for the job, > then by all means use it. > > Speaking of C, I was wondering if anybody has done any experimenting > with using C/C++ and JNI for computational and/or resource intensive > tasks. Since BioJava is based on interfaces, it seems you could replace > sequence implementations and objects that perform calculations on > sequences with C implementations.
I'll put in a mild bite on this one. Many years ago, I wrote a little tool which did some naive (but rather computationally intensive -- or at least it felt that way on the hardware available at the time ;-). It had an AWT frontend, a main loop doing the actual calculations, and some graphing routines grafted on the back. You know the kind of thing... Anyway, version 1 was pure Java all the way through. It was a little slow, so I re-wrote the whole of the main loop in C, and called it through JNI. I got something like a 3-4 times speedup at the time, which, right then, was useful to me. However, there are a few points to note about this: - At the time I was using the very first (probably counts as an alpha) port of JDK1.2 to Linux. This included the dearly departed `sunwjit' compiler, which was *nowhere near* as fast as the current VMs (especially Hotspot server). I'm actually tempted now to dig it all out, see if I can still get the JNI bits to compile, and post new benchmarks. Maybe tommorow. - You only got speed benefits if you shunted the whole loop across to C. Native-coding the body didn't help at all, and maybe even made things worse (I can't remember now). But JNI calls were, at the time, seriously expensive. The cost of Java -> C calling makes me suspect that naively making native implementations of the BioJava stuff is unlikely to be worthwhile in the vast majority of cases. That said, I believe that JNI costs are substantially lower in JDK1.4.x, so it's something which might be worth reconsidering now. Does anyone have *recent* JNI experience, and want to comment on this? Thomas. _______________________________________________ Biojava-l mailing list - [EMAIL PROTECTED] http://biojava.org/mailman/listinfo/biojava-l