From: "Mauricio Fernández" Date: 2004-01-29T03:38:32+09:00 Subject: Re: rjni 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, for a project I have personally nothing to gain from besides 'experience' (I do not use Java :P). Still, I took a look at my code today and felt like playing with it a bit more (I'm finding it exciting again :), but I just don't want to fool anybody into thinking I'll deliver a business-grade product: I can only withstand a limited amount of boring/tedious coding, there are so many interesting things competing with that (which do not require leaving Ruby, btw) ;-) -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Turn right here. No! NO! The OTHER right!