Ruby and Perl

Discussion in 'Ruby' started by Li Chen, Oct 20, 2006.

  1. Li Chen

    Li Chen Guest

    Hi guys,

    I teach myself some Perl before I change to Ruby. I am just curious: If
    I use the same algorithm to write a Perl and Ruby script, respectively,
    which one will run faster? Since everyting in Ruby is object or
    reference to an object the script written by Ruby should run faster than
    that in Perl's.
    Am I right?

    Any comments?

    Thanks,

    Li

    --
    Posted via http://www.ruby-forum.com/.
    Li Chen, Oct 20, 2006
    #1
    1. Advertising

  2. Li Chen

    Guest

    On Sat, 21 Oct 2006, Li Chen wrote:

    > Hi guys,
    >
    > I teach myself some Perl before I change to Ruby. I am just curious: If
    > I use the same algorithm to write a Perl and Ruby script, respectively,
    > which one will run faster? Since everyting in Ruby is object or
    > reference to an object the script written by Ruby should run faster than
    > that in Perl's.
    > Am I right?


    No.

    If you're looking for a general trend, the trend will be that the Ruby
    code will maybe be shorter (if you try to write readable Perl instead of
    line noise Perl, it'll be shorter), it will be far more readable, and
    it'll run more slowly.

    There are exceptions, but that will be the observed trend.


    Kirk Haines
    , Oct 20, 2006
    #2
    1. Advertising

  3. Li Chen

    Squeamizh Guest

    Paul Lutus wrote:
    > At this point, someone might ask what is the point, then? Why have objects?
    > The answer is that some programming problems are sufficiently complex that
    > either it is not possible to write a reliable program without using OO
    > principles, or a particular program can't be written at all using
    > conventional, pre-OO methods.


    Such as... ?
    Squeamizh, Oct 21, 2006
    #3
  4. On 21 Oct 2006, at 00:40, Paul Lutus wrote:

    > Li Chen wrote:
    >
    >> Hi guys,
    >>
    >> I teach myself some Perl before I change to Ruby. I am just
    >> curious: If
    >> I use the same algorithm to write a Perl and Ruby script,
    >> respectively,
    >> which one will run faster? Since everyting in Ruby is object or
    >> reference to an object the script written by Ruby should run
    >> faster than
    >> that in Perl's.
    >> Am I right?

    >
    > Another poster has given you the answer, but I am curious about why
    > you
    > would think that an object-oriented environment would necessarily
    > be faster
    > than one that doesn't have this orientation.

    [snip]

    Because some of us have used Eiffel, Smalltalk and Lisp
    implementations that are pretty darn speedy :) Hell OO Perl is
    speedier than Ruby last time I benchmarked.

    Not that I dislike Ruby. It's fast enough for me, and the decrease in
    developer time more than make up for any decrease in execution speed.
    That doesn't mean that Ruby's speed (or lack thereof) is down to it's
    OO orientation - or that it can't improve (YARV for example).

    Cheers,

    Adrian
    Adrian Howard, Oct 21, 2006
    #4
  5. Li Chen

    Paul Lynch Guest

    On 21 Oct 2006, at 07:15, Paul Lutus wrote:

    > Squeamizh wrote:
    >
    >> Paul Lutus wrote:
    >>> At this point, someone might ask what is the point, then? Why have
    >>> objects? The answer is that some programming problems are
    >>> sufficiently
    >>> complex that either it is not possible to write a reliable program
    >>> without using OO principles, or a particular program can't be
    >>> written at
    >>> all using conventional, pre-OO methods.

    >>
    >> Such as... ?

    >
    > 1. The next version of Windows, the one that Microsoft had intended to
    > write, but gave up on, in spite of the billions of dollars in
    > potential
    > profits. Part of the reason is the well-documented cowboy coder
    > culture at
    > Microsoft, and part of it results from the poorly structured code in
    > present-day Windows.
    >
    > 2. The crime statistic database that the FBI would love to write,
    > spent
    > US$170 million dollars trying to write, but failed to write.
    >
    > 3. The replacement code for the FAA's traffic control system, which
    > they
    > spent many millions developing, only to give up on and revert to
    > their old
    > code and machines.
    >
    > Many similar stories. Dozens.
    >
    > Obviously when I say that such a program can't be written without
    > using OO
    > methods, this is a bit hyperbolic, since these are all examples of
    > programs
    > that can be written in principle, but with budget and time
    > constraints, it
    > is often not possible in practice.


    Add to that virtually any government funded large project.

    However, I suspect that the poster was looking for examples of
    projects that had failed by non-OO methods, but succeeded with OO.

    Paul
    Paul Lynch, Oct 21, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dpackwood
    Replies:
    3
    Views:
    1,792
  2. PerlFAQ Server

    FAQ 1.4 What are Perl 4, Perl 5, or Perl 6?

    PerlFAQ Server, Jan 23, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    298
    PerlFAQ Server
    Jan 23, 2011
  3. PerlFAQ Server
    Replies:
    0
    Views:
    677
    PerlFAQ Server
    Feb 3, 2011
  4. PerlFAQ Server

    FAQ 1.4 What are Perl 4, Perl 5, or Perl 6?

    PerlFAQ Server, Feb 27, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    292
    PerlFAQ Server
    Feb 27, 2011
  5. Dilbert
    Replies:
    0
    Views:
    840
    Dilbert
    Nov 10, 2011
Loading...

Share This Page