From: Robert Bazinet Date: 2005-11-04T12:08:10+09:00 Subject: Re: Ruby Performance vs. Java ------=_Part_28818_18292345.1131073688500 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I would like to see this LogEntry class be rewritten and sent to the author to Mr. Kumar and rerun the tests to see what optimized code in Ruby can do against his Java code. I plan to do my next couple projects in Ruby and use these as a learning tool for Ruby. I think with the addition of a VM it should make some nice strides. Thanks for all that responded. -Rob Bazinet On 11/3/05, Ryan Leavengood wrote: > > On 11/3/05, Ryan Leavengood wrote: > > > > Also, I would suspect that Mr. Kumar's Ruby code could benefit from > > some tweaking by the experts on this list. Recent threads have shown > > that smarter algorithms can make Ruby code much, much faster. In my > > opinion his run against his log files seems absurdly slow. > > To respond to myself, it seems the main culprit is Mr. Kumar's > LogEntry class, whose source code can be gotten here: > http://www.pankaj-k.net/archives/ruby_java/logentry.rb > > I've done some benchmarking and the biggest CPU hog is the call to > DateTime.strptime. By changing that call to just DateTime.new > (arguably removing some functionality from the class), the runtime > performance of 10,000 iterations of calling LogEntry.new goes from > 24.18 seconds to 7.39 seconds, on my laptop (P4 2.8 GHz, 1 GB RAM, > Windows XP, similar to his test system.) > > I believe his regular expressions could be improved as well. Anyone up > to the challenge of making this LogEntry class much faster? > > Ryan > > ------=_Part_28818_18292345.1131073688500--