Professional Web Applications Themes

speed benchmarks comparing Ruby to Py/Perl/PHP/etc? - Ruby

I know Ruby wasn't created to make a fast-running language. But I just realized I've never seen any Ruby benchmarks, comparing it to other languages under heavy load or speed. Anyone seen some? I ask for a real reason becuase it's under consideration to replace PHP with Ruby on a high-traffic website I work with....

  1. #1

    Default speed benchmarks comparing Ruby to Py/Perl/PHP/etc?

    I know Ruby wasn't created to make a fast-running language.

    But I just realized I've never seen any Ruby benchmarks, comparing
    it to other languages under heavy load or speed.

    Anyone seen some?

    I ask for a real reason becuase it's under consideration to
    replace PHP with Ruby on a high-traffic website I work with.


    Ruby Guest

  2. #2

    Default Re: speed benchmarks comparing Ruby to Py/Perl/PHP/etc?

    On 2004-02-19, Ruby Baby <com> wrote: 

    From my expirence, Ruby is slower than both Python or PHP.
    That sad, I wouldn't be too nervous on using for a website
    in conjuction with mod_ruby. For most typical webscripts,
    runtime is mainly a factor of two things:

    Startup time (essentially zero with mod_ruby. This is also why PHP feels
    so fast)
    Database querys (Not a language thing really, but where most of the time
    is spent)




    --
    Tyler Eaves "No swimming in the heavy water,
    or singing in the acid rain"

    - Rush, "Distant Early Warning"
    Tyler Guest

  3. #3

    Default Re: speed benchmarks comparing Ruby to Py/Perl/PHP/etc?

    > I know Ruby wasn't created to make a fast-running language. 

    No.
     

    As a complete non-expert, I suggest you try out FastCGI (just ask Ara
    Howard) and squid (just to cache responses to take the heat off your app).
    If those technologies are amenable to your application, it wouldn't
    matter if you wrote it in Commodore 64 BASIC.

    Cheers,
    Gavin




    Gavin Guest

  4. #4

    Default Re: speed benchmarks comparing Ruby to Py/Perl/PHP/etc?

    If you run a search on google for The Great Programming Language Shootout it
    shows performance graphs between a number of languages in a number of categories
    including tight loops, number crunching, etc. I don't remember if php was
    included though, perl and python were though. Actually that's a good
    site to research how different languages approach certain problems as well.

    Charles Comstock

    On Thu, 19 Feb 2004, Gavin Sinclair wrote:
     
    >
    > No.

    >
    > As a complete non-expert, I suggest you try out FastCGI (just ask Ara
    > Howard) and squid (just to cache responses to take the heat off your app).
    > If those technologies are amenable to your application, it wouldn't
    > matter if you wrote it in Commodore 64 BASIC.
    >
    > Cheers,
    > Gavin
    >
    >
    >
    >
    >[/ref]

    Charles Guest

  5. #5

    Default Re: speed benchmarks comparing Ruby to Py/Perl/PHP/etc?

    il Thu, 19 Feb 2004 13:20:58 +0900, Ruby Baby <com> ha
    scritto::
     


    all the benchmarks out there (i.e. doug's shootout) are really
    outdated. ruby seem to be slower than python or perl, but faster than
    php. Anyway, an apache benchmark against each plain mod_* or fastcgi
    solution would be really interesting :)
    gabriele Guest

  6. #6

    Default Re: speed benchmarks comparing Ruby to Py/Perl/PHP/etc?


    "Ruby Baby" <com> schrieb im Newsbeitrag
    news:hitmedia.com... 

    There was an interesting post on this earlier, which seems to indicate
    that Ruby *can* be an order of magnitude faster than PHP:
    http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/86925

    Regards

    robert

    Robert Guest

  7. #7

    Default Re: speed benchmarks comparing Ruby to Py/Perl/PHP/etc?

    > If you run a search on google for The Great Programming Language Shootout it 


    How funny :

    Perl, Python, Ruby all next to eachother - same results:

    http://www.bagley.org/~doug/shootout/craps.shtml


    (though this was 3 years ago)


    Ruby Guest

  8. #8

    Default Re: speed benchmarks comparing Ruby to Py/Perl/PHP/etc?

    il Thu, 19 Feb 2004 01:13:14 -0600, Charles Comstock
    <wustl.edu> ha scritto::
     
    it included php, but sadly to say, that shootout is abandoned.
    it may be interesting, somehow, but ruby, as an exmaple changed a lot
    from 1.6.6 to 1.8.1, even adding idiomatic faster ways to do things
    (i.e. block parameters to build hashes or arrays.)

    There is an effort (in early stage) to build a newer
    benchmark/comparison framework at scutigena.sf.net if you're
    interested in this kind of stuff :)
    gabriele Guest

  9. #9

    Default Re: speed benchmarks comparing Ruby to Py/Perl/PHP/etc?

    On Thu, 19 Feb 2004, Ruby Baby wrote:
     

    we have done that. however, we also use fastcgi. using fastcgi should give
    you around one to two orders of magnitude speedup (according to seige). when
    this is done the speed of the actual lang is completely insignificant.

    -a
    --
    ================================================== =============================
    | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
    | PHONE :: 303.497.6469
    | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
    | URL :: http://www.ngdc.noaa.gov/stp/
    | TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done
    ================================================== =============================

    Ara.T.Howard Guest

  10. #10

    Default Re: speed benchmarks comparing Ruby to Py/Perl/PHP/etc?

    George Gambill wrote:
     
    You misunderstood, he probably meant that you can rewrite the
    speed-critical parts of the application in C while keeping the rest of
    the program in ruby. but otherwise there is no ruby->C converter around
    (that I know about).

    emmanuel



    Emmanuel Guest

  11. #11

    Default Re: speed benchmarks comparing Ruby to Py/Perl/PHP/etc?

    On Thu, 19 Feb 2004, gabriele renzi wrote:
     
    >
    >
    > all the benchmarks out there (i.e. doug's shootout) are really
    > outdated. ruby seem to be slower than python or perl, but faster than
    > php. Anyway, an apache benchmark against each plain mod_* or fastcgi
    > solution would be really interesting :)[/ref]

    something like this was posted - about a year ago - but i cannot seem to find
    it...

    this thread is interesting though

    http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=20021006082518.A73241%40freeze.org&rnum= 60&prev=/groups%3Fq%3Dfastcgi%2B%2B%2Bgroup:comp.lang.ruby% 26start%3D50%26hl%3Den%26lr%3D%26ie%3DUTF-8%26scoring%3Dd%26selm%3D20021006082518.A73241%254 0freeze.org%26rnum%3D60

    in particular

    http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=20021006082518.A73241%40freeze.org&rnum= 60&prev=/groups%3Fq%3Dfastcgi%2B%2B%2Bgroup:comp.lang.ruby% 26start%3D50%26hl%3Den%26lr%3D%26ie%3DUTF-8%26scoring%3Dd%26selm%3D20021006082518.A73241%254 0freeze.org%26rnum%3D60

    i have fastcgi and the lastest php installed on my machine. i could run some
    bencharks if i intalled mod_ruby and have good enough test suite. imho a good
    test would hit a database and generate some dynamic html from some sort of
    templating library.


    i can tell you now though that:

    [ahowardwww ahoward]$ ab -n 1024 http://127.0.0.1/env.fcgi | egrep Requests
    Requests per second: 221.74 [#/sec] (mean)

    [ahowardwww ahoward]$ ab -n 1024 http://127.0.0.1/env.cgi | egrep Requests
    Requests per second: 9.98 [#/sec] (mean)

    and

    [ahowardwww ahoward]$ cat /usr/local/httpd/htdocs/env.fcgi
    #!/usr/local/ruby-1.8.0/bin/ruby
    require 'cgi'
    require 'fcgi'

    FCGI.each_cgi do |cgi|
    content = ''
    env = []
    cgi.env_table.each{|k,v| env << [k,v]}
    env.sort!
    env.each{|k,v| content << %Q(#{k} => #{v}<br>\n)}
    cgi.out{content}
    end

    [ahowardwww ahoward]$ cat /usr/local/httpd/htdocs/env.cgi
    #!/usr/local/ruby-1.8.0/bin/ruby
    require 'cgi'
    require 'fcgi'

    FCGI.each_cgi do |cgi|
    content = ''
    env = []
    cgi.env_table.each{|k,v| env << [k,v]}
    env.sort!
    env.each{|k,v| content << %Q(#{k} => #{v}<br>\n)}
    cgi.out{content}
    end

    eg. they are the same exact program, which is nice too. for me this shows
    that fastcgi is 'fast enough', though i can appreciate the desire for more
    extensive testing.

    -a

    --
    ================================================== =============================
    | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
    | PHONE :: 303.497.6469
    | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
    | URL :: http://www.ngdc.noaa.gov/stp/
    | TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done
    ================================================== =============================

    Ara.T.Howard Guest

  12. #12

    Default Re: speed benchmarks comparing Ruby to Py/Perl/PHP/etc?

    Ruby Baby wrote: 

    Vaguely related -- could someone confirm that the following suggestions
    are still valid for Ruby 1.8+ (the test circa Ruby 1.6.6)

    http://www.bagley.org/~doug/shootout/lang/ruby/
    (See the bottom of the url for the few performance tips.)

    Anyone have additional tips to add?

    --
    (-, /\ \/ / /\/
    Gavin Guest

  13. #13

    Default Re: speed benchmarks comparing Ruby to Py/Perl/PHP/etc?

    Tyler Eaves wrote: 
    >
    > From my expirence, Ruby is slower than both Python or PHP.
    > That sad, I wouldn't be too nervous on using for a website
    > in conjuction with mod_ruby. For most typical webscripts,
    > runtime is mainly a factor of two things:
    >
    > Startup time (essentially zero with mod_ruby. This is also why PHP feels
    > so fast)[/ref]

    fastcgi is even better.
     

    I agree, that's the most important point; the speed of the language
    interpreter itself is pretty irrelevant.
    Andreas Guest

  14. #14

    Default Re: speed benchmarks comparing Ruby to Py/Perl/PHP/etc?

    gabriele renzi wrote: 
    >
    > it included php, but sadly to say, that shootout is abandoned.
    > it may be interesting, somehow, but ruby, as an exmaple changed a lot
    > from 1.6.6 to 1.8.1, even adding idiomatic faster ways to do things
    > (i.e. block parameters to build hashes or arrays.)
    >
    > There is an effort (in early stage) to build a newer
    > benchmark/comparison framework at scutigena.sf.net if you're
    > interested in this kind of stuff :)[/ref]

    Your only using ruby 1.7.2, not 1.8.1, any particular reason why?

    Charlie
    Charles Guest

  15. #15

    Default Re: speed benchmarks comparing Ruby to Py/Perl/PHP/etc?

    il Thu, 19 Feb 2004 10:41:22 -0600, Charles Comstock
    <wustl.edu> ha scritto::

     

    it's not *me* it's *they*.. but I happen to know the anwser :)
    I suggested one of the authors to move to ruby 1.8.1 and they said the
    had problem with stack overflow with the calculation of ackermann(3,7)
    on they machine (some debian with ruby deb pkg).
    If you can solve that issue they'd pleased to upgrade.
    Anyway the framework is enough good to allow you to run it with you
    own ruby version just by doing some cp/mv/mkdir
    gabriele Guest

  16. #16

    Default Re: speed benchmarks comparing Ruby to Py/Perl/PHP/etc?

    Hi!

    * Ruby Baby: 

    Is a Trabant (built in GDR, maximum speed ~ 107 km/h) faster than a
    BWM? It depends. If the lights turn green a BMW driver sees the back
    of a Trabant due to the Trabant's low mass. After some hundred meters
    the BWM is in lead.

    Is Ruby faster than PHP? Again the question is: Given what scenario?

    Josef 'Jupp' SCHUGT
    --
    http://oss.erdfunkstelle.de/ruby/ - German comp.lang.ruby FAQ
    http://rubyforge.org/users/jupp/ - Ruby projects at Rubyforge


    Josef Guest

Similar Threads

  1. Benchmarks
    By mbrugo@yahoo.it in forum PostgreSQL / PGSQL
    Replies: 6
    Last Post: January 15th, 02:45 AM
  2. Replies: 46
    Last Post: January 23rd, 09:29 PM
  3. Ruby speed comparison
    By Markus Hillbrand in forum Ruby
    Replies: 2
    Last Post: October 19th, 08:05 PM
  4. Replies: 1
    Last Post: August 15th, 11:50 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139