From: intc_ctor@... (Phil Tomson) Date: 2004-01-29T09:04:55+09:00 Subject: Re: rjni Mauricio Fern�ndez wrote in message news:<20040128183828.GA24920@student.ei.uni-stuttgart.de>... > On Thu, Jan 29, 2004 at 02:59:54AM +0900, Phil Tomson wrote: > > > I have to confess it's not a matter of time -- it's just that I'm facing > > > the need to rewrite it all in C (for performance) and frankly that's no > > > fun :-| > > > > Would it be premature optimization? In other words, do you have all > > the functionality you need with Ruby code yet? If you don't rewrite > > in C is the performance in Ruby acceptable? > > The main slowdown comes from overloading. Simple methods can be > dispatched at a rate of 30000/s or so on a 1700XP+ K7. However, once > you get several methods with different signatures (but same name) this > figure degrades quickly. > > > I think in most cases performance is probably acceptable. In cases > > like this, I (as a user) like having the option of using the pure > > Ruby implementation if possible because I'm not always in a position > > to compile the extension. So I would recommend that when you do the > > An extension _is_ always needed (I don't think I could wrap all of JNI > only with Ruby/DL). What I meant is that in the current code base only > a basic JNI wrapping is implemented in C, and everything else (method > dispatching, parameter conversion, simulation of singletons, > exceptions...) is written in Ruby using the extension. > > [...] > > > Where rjni_speedup.so contains the C implementations for various > > methods that could benefit from a C implementation. That way you > > don't have to think that you need to rewrite everything over in C > > before you can release, you can release small chunks of C > > implementation as you have time. > > > That's a possibility... surely way more gratifying than having to write > some 10000-15000 lines of tedious, boring C code, Can a tool like Swig help to automate the process? I wouldn't want to type in that much C code either. Check out http://www.swig.org and see if it will help you avoid all that coding. Phil