[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

looking at ruby...

Sean T Allen

1/23/2005 4:03:00 AM

So I'm looking at ruby for both personal and work projects.

Trying to assess whether it would fit my needs.

I definitely like the language as a whole however, I have questions...

most of them in comparison to perl

Most are library related...

Anyway here goes

1. Can someone point me to benchmarks for ruby vs. other languages, perl
in particular but others as well would be nice. I found a few using
google
but they all seemed to be from 2001-2002 which makes the numbers
rather out of date as I expect ruby has improved speed wise since
then...

2. mod_ruby vs mod_perl. mod_ruby looks from the surface to be pretty
complete...
are there features implemented in mod_perl that mod_ruby lacks?
are there any problems or 'gotchas' with mod_ruby?

3. Are there ruby templating engines that are comparable feature-wise to
perl's Template Toolkit? I looked through raa but didnt really find
anything
that would fit that basic description. In particular the built in
caching for
speed is one area... but the big features here for me are the Plugin
and Filter interfaces for extending the template system.

4. perl has a Business::Online module that has various sub-module for
using online payment transaction systems through a unified interface.
Do similar libraries exist for ruby?

5. Ruby on rails - Active Records. It looks like a really nice system...
comparable
to Class::DBI in a lot of was... question I have is... what kind of
performance
hit does it incur above using DBI. In the perl universe, we decided not
to use Class::DBI because of said considerations...

6. Marshalling speed... perl has the Storable module which alas is a tad
slow...
how does ruby do in this area?

7. Does ruby on rails work only with a cgi interface or does it work
with mod_ruby?

That is my first initial round of questions... I can see a number of
ways that
ruby would certainly make our code easier to deal with and understand as it
makes a lot of the design patterns we use a lot easier to implement,
understand etc.
And we use a good number of objects in perl which are rather heavy to
construct etc.
However, perl does have cpan the breadth and depth of which helps offset
some
of these issues.

My big concern would be diving into ruby to save time and ease
development in
one area only to have the gains lost in another.

Either way, I'm going to be playing around which ruby as like a lot
about it...
I played around with Python a few years ago but at the time it had a
number of
issues that kept it from being used ( no dbi type interface at the time,
issues with
extending c based classes... ). I started all this by revisiting python but
found that ruby as a language is closer to what I am looking for...

Anyway... you help... thoughts, answers etc greatly appreciated...


31 Answers

Eric Hodel

1/23/2005 7:40:00 AM

0

On 22 Jan 2005, at 20:03, Sean T Allen wrote:

> 1. Can someone point me to benchmarks for ruby vs. other languages,
> perl
> in particular but others as well would be nice. I found a few using
> google
> but they all seemed to be from 2001-2002 which makes the numbers
> rather out of date as I expect ruby has improved speed wise since
> then...

Premature optimization is the root of all evil. Ruby is fast enough
for everybody here, and its fast enough for basecamphq.com and
43things.com.

If you really need something to be fast, use the 90/10 rule. Find the
10% of your code that does all the work, and use RubyInline to optimize
it into C.

> 2. mod_ruby vs mod_perl. mod_ruby looks from the surface to be pretty
> complete...
> are there features implemented in mod_perl that mod_ruby lacks?
> are there any problems or 'gotchas' with mod_ruby?

FastCGI is recommended for Rails deployments, but also works on
mod_ruby. There used to be a problem where you could not gracefully
restart a mod_ruby enabled server due to memory leakage, but this may
no longer exist.

> 3. Are there ruby templating engines that are comparable feature-wise
> to
> perl's Template Toolkit? I looked through raa but didnt really find
> anything
> that would fit that basic description. In particular the built in
> caching for
> speed is one area... but the big features here for me are the Plugin
> and Filter interfaces for extending the template system.

Everybody has written a template tool for Ruby, and ERB (which comes
with Ruby) supports caching of 'compiled' templates. Not being
familiar with the Template Toolkit, I don't know what to say about it.

> 4. perl has a Business::Online module that has various sub-module for
> using online payment transaction systems through a unified
> interface.
> Do similar libraries exist for ruby?

There's currently a bounty out for this.

> 5. Ruby on rails - Active Records. It looks like a really nice
> system... comparable
> to Class::DBI in a lot of was... question I have is... what kind of
> performance
> hit does it incur above using DBI. In the perl universe, we decided
> not
> to use Class::DBI because of said considerations...

AR is plenty fast, and it does not use Ruby's DBI. By plenty fast, I
mean basecamphq.com and 43things.com both run off AR, and we don't plan
on switching to anything else any time soon.

> 6. Marshalling speed... perl has the Storable module which alas is a
> tad slow...
> how does ruby do in this area?

Ruby's Marshal is plenty fast, some time ago there were
YAML/ruby/perl/python/etc marshalling benchmarks, and I believe Ruby's
Marshal did very well compared to all comers (maybe beating?). Add
memcached as an excellent place to store this data and its plenty
faster.

> 7. Does ruby on rails work only with a cgi interface or does it work
> with mod_ruby?

WEBrick, CGI, FastCGI and mod_ruby are built in.

> That is my first initial round of questions... I can see a number of
> ways that
> ruby would certainly make our code easier to deal with and understand
> as it
> makes a lot of the design patterns we use a lot easier to implement,
> understand etc.
> And we use a good number of objects in perl which are rather heavy to
> construct etc.

Ruby removes lots of 'code smell' (code that smells like code, where
brute force coding is used rather than elegant language)

> However, perl does have cpan the breadth and depth of which helps
> offset some
> of these issues.

Most of the perl modules you would use already have Ruby equivalents.

> My big concern would be diving into ruby to save time and ease
> development in
> one area only to have the gains lost in another.

Most of your questions seem to be Rails-focused...

So I would recommend spending one week, no more, trying out Rails and
seeing if it is a fit for your work. With Ruby and Rails, one week is
more than sufficient to learn enough about Ruby and Rails to make a
well-informed decision. I would wager that it will actually take less
than a week, simply because Ruby and Rails are that easy, that fast,
and that cool.

> Either way, I'm going to be playing around which ruby as like a lot
> about it...

Excellent!

--
Eric Hodel - drbrain@segment7.net - http://se...
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

Lothar Scholz

1/23/2005 7:58:00 AM

0

Hello Eric,

EH> Ruby is fast enough
EH> for everybody here, and its fast enough for basecamphq.com and
EH> 43things.com.

But since the ruby community is still very very small this is maybe
not a very clever answer.

In the average ruby is a little bit slower then perl or python but
it might not be a problem for most usecases.


--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ru...
CTO Scriptolutions Ruby, PHP, Python IDE 's




Paris Sinclair

1/23/2005 9:24:00 AM

0

Paris Sinclair

1/23/2005 9:43:00 AM

0

Yukihiro Matsumoto

1/23/2005 9:55:00 AM

0

Hi,

In message "Re: looking at ruby..."
on Sun, 23 Jan 2005 18:43:10 +0900, Paris Sinclair <paris@perlpuma.net> writes:

|Since normally these are used for data structures not just strings, I would
|say, Storable is slow, and Marshal is twice as slow.

On your machine. I got

# time perl -MStorable='freeze,thaw' -e '$start = time; for($i=0;$i<100;$i++) { for($j=0;$j<100;$j++) { $foo[$i][$j] = ${thaw(freeze(\([rand,rand,rand])))} } }; print time - $start'
1
real 0m0.943s
user 0m0.900s
sys 0m0.005s

# time ruby -e 'foo = []; start = Time.new ; (0...100).each { |i| foo[i] = [] ; (0...100).each { |j| foo[i][j] = Marshal.load(Marshal.dump([rand,rand,rand])) } } ; puts Time.new - start'
0.371891

real 0m0.379s
user 0m0.334s
sys 0m0.004s

on my Linux box (Pentium M 1.6MHz).

matz.


Paris Sinclair

1/23/2005 10:12:00 AM

0

Premshree Pillai

1/23/2005 3:20:00 PM

0

On Sun, 23 Jan 2005 13:03:17 +0900, Sean T Allen <sean@ardismg.com> wrote:
> So I'm looking at ruby for both personal and work projects.
>
> Trying to assess whether it would fit my needs.
>
> I definitely like the language as a whole however, I have questions...
>
> most of them in comparison to perl
>
> Most are library related...
>
> Anyway here goes
>
> 1. Can someone point me to benchmarks for ruby vs. other languages, perl
> in particular but others as well would be nice. I found a few using
> google

You can find some standard benchmarks at http://shootout.alioth.d...

> but they all seemed to be from 2001-2002 which makes the numbers
> rather out of date as I expect ruby has improved speed wise since
> then...
>
> 2. mod_ruby vs mod_perl. mod_ruby looks from the surface to be pretty
> complete...
> are there features implemented in mod_perl that mod_ruby lacks?
> are there any problems or 'gotchas' with mod_ruby?
>
> 3. Are there ruby templating engines that are comparable feature-wise to
> perl's Template Toolkit? I looked through raa but didnt really find
> anything
> that would fit that basic description. In particular the built in
> caching for
> speed is one area... but the big features here for me are the Plugin
> and Filter interfaces for extending the template system.
>
> 4. perl has a Business::Online module that has various sub-module for
> using online payment transaction systems through a unified interface.
> Do similar libraries exist for ruby?
>
> 5. Ruby on rails - Active Records. It looks like a really nice system...
> comparable
> to Class::DBI in a lot of was... question I have is... what kind of
> performance
> hit does it incur above using DBI. In the perl universe, we decided not
> to use Class::DBI because of said considerations...
>
> 6. Marshalling speed... perl has the Storable module which alas is a tad
> slow...
> how does ruby do in this area?
>
> 7. Does ruby on rails work only with a cgi interface or does it work
> with mod_ruby?
>
> That is my first initial round of questions... I can see a number of
> ways that
> ruby would certainly make our code easier to deal with and understand as it
> makes a lot of the design patterns we use a lot easier to implement,
> understand etc.
> And we use a good number of objects in perl which are rather heavy to
> construct etc.
> However, perl does have cpan the breadth and depth of which helps offset
> some
> of these issues.
>
> My big concern would be diving into ruby to save time and ease
> development in
> one area only to have the gains lost in another.
>
> Either way, I'm going to be playing around which ruby as like a lot
> about it...
> I played around with Python a few years ago but at the time it had a
> number of
> issues that kept it from being used ( no dbi type interface at the time,
> issues with
> extending c based classes... ). I started all this by revisiting python but
> found that ruby as a language is closer to what I am looking for...
>
> Anyway... you help... thoughts, answers etc greatly appreciated...
>
>
>


--
Premshree Pillai
http://www.livejournal.com/...


Eric Hodel

1/23/2005 7:16:00 PM

0

On 22 Jan 2005, at 23:57, Lothar Scholz wrote:

> Hello Eric,
>
> EH> Ruby is fast enough
> EH> for everybody here, and its fast enough for basecamphq.com and
> EH> 43things.com.
>
> But since the ruby community is still very very small this is maybe
> not a very clever answer.

Commonly, it is the truth. By omitting my full response though, you
misrepresent my statement.

Writing C extensions in Ruby is hardly more difficult than writing
plain Ruby code, and with a tool like RubyInline, it only gets easier.
Beacuse of this, many people find no problem using Ruby despite it
being slower than other languages.

--
Eric Hodel - drbrain@segment7.net - http://se...
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

Paris Sinclair

1/23/2005 9:46:00 PM

0

Paris Sinclair

1/23/2005 10:03:00 PM

0