From: Robert Klemme Date: 2012-02-03T19:40:43+09:00 Subject: Re: Basic Ruby performance On Fri, Feb 3, 2012 at 3:14 AM, Dmitry Nikiforov wrote: > Ryan Davis wrote in post #1043801: > >> Choosing the right language is a lot less important than choosing the >> right algorithm: >> >> 5461 % time ruby -e 'n = 10**8; p (n + 3*n**2 + 2*n**3)/6' >> 333333338333333350000000 >> >> real  0m0.009s >> user  0m0.004s >> sys  0m0.004s > > My code was merely an example of very simple loop. Its purpose was not > to calculate something, but run through the loop, and execute > multiplication on every iteration. Yes, and maybe it was a bad example for what you are trying to do: > My main area of development is processing of rather large amounts of > data (billions of entries, primarily processed by regular expressions, > with some statistical analysis on top, and potentially - addition of NLP > later). You _have_ to iterate through every entry of the incoming data > (which might already be in the database, plain text file, or might be > just a "fire hose" of data pouring into the system in real time). Question: the data needs to come from somewhere. Are you sure that your processing is CPU bound? If it is IO bound the difference between Perl and Ruby won't really show. I reckon it's better to create a more realistic example of what you are trying to do and measure again. (And take care to run tests between Ruby and Perl alternating in order to prevent OS IO caching from preferring one or the other.) Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/