From: ptkwt@... (Phil Tomson) Date: 2003-09-23T05:31:17+09:00 Subject: Re: Performance: Ruby vs Java In article <41137062.20020219123425@scriptolutions.com>, Lothar Scholz wrote: >Hello Lalit, > >Monday, September 22, 2003, 1:48:09 AM, you wrote: > >LP> I'm a newcomer to Ruby, and thought I would write a little >LP> brute-force-search program to see how Ruby compares to Java - >LP> performance wise. The results surprised me (I was hoping Ruby would >LP> fare a lot better than it did!). On my WinXP box (AthlonXP 1800+, >LP> 768Meg RAM), the Ruby program takes 1min 50secs to complete, while a >LP> similar java program takes 0.6 secs. > >Ruby is the wrong language for programs like this. A speed difference >of 18000% (or 180 times) is not unusual if you try to port algorithms on >large data >sets with lots of low level calculations. But that doesn't mean you can't use Ruby on the project... How much code is really speed critical? It's going to vary depending on what type of project you're doing, but in most cases it's probably 10% or less. Since it's easy to extend Ruby with C/C++ code, Ruby can still be a very good choice for a project which requires high performance in some areas of the code. Tools like swig (http://www.swig.org), rubyinline (http://sourceforge.net/projects/rubyinline/), and cgenerator (http://redshift.sourceforge.net/cgen/) make it even easier to create C/C++ extensions for code that is performance sensitive. Phil