From: Charles O Nutter Date: 2006-07-27T06:00:26+09:00 Subject: Re: For performance, write it in C ------=_Part_16705_27800743.1153947623757 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 7/26/06, Ron M wrote: > > Charles O Nutter wrote: > > I'll lob a couple of grenades and then duck for cover. > > > > - Write it in C is as valid as write it in Java (as someone else > > mentioned). > > Not really. In C you can quite easily use inline assembly > to do use your chips MMX/SSE/VIS/AltiVec extensions and if > you need more, interface to your GPU if you want to use it > as a coprocessor. > > I don't know of any good way of doing those in Java except > by writing native extensions in C or directly with an assembler. > So you're saying that when writing an extension to Ruby in C you can also manually write assembly to speed up specific aspects of your code, and that when writing an extrenion in Java you'd have to manually write assembly to speed up specific aspect of your code? The great hassle of writing Java Native Interface code aside (which is really a one-time cost) what exactly is the difference here? On any platform, Java included, you can eventually call out to C code to do some processor specific or really performance-intensive task. Java doesn't make it as easy as Ruby, but it also performs quite a bit better than Ruby for most cases. It's only in rare cases that you actually need to write native code to make a Java app perform well. However in the Ruby world, that tends to be the stock answer...if it's not fast enough, give up on Ruby! I can absolutely appreciate the gains shown by moving targetted pieces of code from Ruby to C. In those examples, Ruby's power is grossly underutilized, so the conversion to a less feature-rich language with less overhead makes a great deal of sense. However I would challenge the Ruby community at large to expect more from Ruby proper before giving up the dream of highly-performant Ruby code and plunging into the C. -- Charles Oliver Nutter @ headius.blogspot.com JRuby Developer @ www.jruby.org Application Architect @ www.ventera.com ------=_Part_16705_27800743.1153947623757--