2007-01-12

Ruby vs Perl

I've been working with Perl for the last 15 years and it's safe to say that I know Perl and I know her well, but as for Ruby, I've only been learning it for the last two weeks and unfortunately I've come to a conclusion that I thought would take a little bit longer if it were going to happen at all!

I've read the entire Pick-Axe book (version 2) and was extremely excited about the language in general as it has some very nice features that I could very easily become accustomed to but I felt that I needed to have a comparison against my favourite language in order to make a better decision.

I have a price list Excel document that I need to extract just two columns from, B and J.

The filesize is approx. 3.5MB and all in all, it's a pretty straight foward request.

Ruby loaded the Excel document into memory in 1.9 seconds as opposed to Perl doing it in 2.1 seconds (yep, IO is dependant on what's going on at the time so this could certainly be a skewed result).

But unfortunately, Ruby took a total of 21 lines of code to accomplish the same thing that Perl did in only 6 lines!

I certainly have a steep learning curve before I'm half as fluent in Ruby as I am in Perl but when it comes to the crunch, the simple tasks are what I use Perl for. If Ruby can't cut it in regards to being fast to code, them I'm going to have to put Ruby on the back-burner.

Unless someone can show me better stats and less code, Perl is the choice for me.

No comments: