# Re: Ruby vs. PHP

**URL:** <https://www.ruby-forum.com/t/re-ruby-vs-php/116591>\
**Category:** Ruby\
**Created:** [October 7, 2007, 7:15pm UTC](https://www.ruby-forum.com/t/re-ruby-vs-php/116591 "2007-10-07T19:15:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![igouy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ce7236/32.png) [@igouy](https://www.ruby-forum.com/u/igouy)\
**Post date:** [October 7, 2007, 7:15pm UTC](https://www.ruby-forum.com/t/re-ruby-vs-php/116591/1 "2007-10-07T19:15:25Z")

</div>

M. Edward (Ed) Borasky wrote:

-snip-

> The raw numbers that went into this are from the Alioth shootout  
> page, and what I _haven’t_ done is checked out which versions of  
> Perl, Python, YARV, Ruby, jRuby and PHP these tests used. They  
> could be years old or they could have been run yesterday morning. 🙂  
> I discarded all the tests for which there were any missing values.

Perl v5.8.8  
Python 2.5.1  
Ruby 1.9.0 (2007-08-14 patchlevel 0) [i686-linux]  
Ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]  
Ruby 1.8.5 (2007-06-07 rev 3841) [i386-jruby1.0]  
PHP 5.2.2-pl1-gentoo (cli)

You haven’t mentioned how many remained after you discarded those with  
missing values: at least 7 discards - Ruby 1.9.0 has 5, PHP another  
one, JRuby another one. Did you actually include “hello world”?

-snip-

> Now suppose your boss comes to you, as bosses do, and says,  
> “well, all them high-falutin’ box plots are dandy, but the board  
> of directors wants one number for each language!” It turns out  
> (and I’ll let Google and Wikipedia fill in the blanks for you)  
> that the one number you want to give your boss, aside from your  
> cell phone number, is the _geometric mean_ of all the benchmark  
> ratios. Again, smaller is better.

geometric mean (of ratios to most performant program):

[http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=all&lang=all](http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=all&lang=all)

-snip-

> It’s pretty clear to me from these numbers is that the only  
> reason that deploying web applications on the LAMP stack and its  
> cousins using PostgreSQL, Perl, Python and Ruby is economically  
> viable is that they spend most of their time either in the database  
> or on the network.

As in - “we have found that the CPU time is rarely the limiting factor;  
the expressibility of the language means that most programs are small  
and spend most of their time in I/O and native run-time code.”

[http://shootout.alioth.debian.org/gp4/miscfile.php?file=benchmarking&title=Flawed%20Benchmarks](http://shootout.alioth.debian.org/gp4/miscfile.php?file=benchmarking&title=Flawed%20Benchmarks)

```
  ____________________________________________________________________________________

```

Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user  
panel and lay it on us.  
[http://surveylink.yahoo.com/gmrs/yahoo\_panel\_invite.asp?a=7](http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7)

---

<div class="post-metadata">

**Author:** ![igouy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ce7236/32.png) [@igouy](https://www.ruby-forum.com/u/igouy)\
**Post date:** [October 7, 2007, 9:18pm UTC](https://www.ruby-forum.com/t/re-ruby-vs-php/116591/2 "2007-10-07T21:18:40Z")

</div>

— “M. Edward (Ed) Borasky” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> If there are things I should throw out, let me know and I’ll re-run  
> the plots.

hello

The more interesting approach would be how can we fix the other failing  
programs so you don’t need to throw stuff out - is it that hard to fix  
fannkuch, nsieve-bits, recursive and reverse-complement for Ruby Core?

---

<div class="post-metadata">

**Author:** ![igouy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ce7236/32.png) [@igouy](https://www.ruby-forum.com/u/igouy)\
**Post date:** [October 7, 2007, 8:59pm UTC](https://www.ruby-forum.com/t/re-ruby-vs-php/116591/3 "2007-10-07T20:59:19Z")

</div>

Isaac G. wrote:

> You haven’t mentioned how many remained after you discarded those with  
> missing values: at least 7 discards - Ruby 1.9.0 has 5, PHP another  
> one, JRuby another one. Did you actually include “hello world”?

Allow me to show off in R (left-most column is a row number – ignore  
it):

> ln.ratio[,1:2]  
> test iter  
> 1 binarytrees 12  
> 2 binarytrees 14  
> 3 binarytrees 16  
> 10 fasta 250000  
> 11 fasta 2500000  
> 13 hello 1  
> 14 hello 200  
> 15 knucleotide 10000  
> 16 knucleotide 100000  
> 17 knucleotide 1000000  
> 18 mandelbrot 120  
> 19 mandelbrot 600  
> 20 mandelbrot 3000  
> 25 nbody 200000  
> 26 nbody 2000000  
> 27 nbody 20000000  
> 28 nsieve 7  
> 29 nsieve 8  
> 30 nsieve 9  
> 34 partialsums 25000  
> 35 partialsums 250000  
> 36 partialsums 2500000  
> 37 pidigits 500  
> 38 pidigits 1500  
> 39 pidigits 2500  
> 40 recursive 3  
> 41 recursive 7  
> 43 regexdna 100000  
> 44 regexdna 300000  
> 45 regexdna 500000  
> 49 spectralnorm 500  
> 50 spectralnorm 3000  
> 51 spectralnorm 5500  
> 52 sumcol 1000  
> 53 sumcol 11000  
> 54 sumcol 21000

If there are things I should throw out, let me know and I’ll re-run the  
plots.

> geometric mean (of ratios to most performant program):
> 
> [http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=all&lang=all](http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=all&lang=all)

Yeah, I saw that. I wanted to use gcc as the baseline for everything.

> As in - “we have found that the CPU time is rarely the limiting factor;  
> the expressibility of the language means that most programs are small  
> and spend most of their time in I/O and native run-time code.”
> 
> [http://shootout.alioth.debian.org/gp4/miscfile.php?file=benchmarking&title=Flawed%20Benchmarks](http://shootout.alioth.debian.org/gp4/miscfile.php?file=benchmarking&title=Flawed%20Benchmarks)

For nice tight “inner interpreters” aka “virtual machines”, true,  
including YARV. I’m seeing otherwise for MRI. This is not news to the  
Ruby community, btw.

---

<div class="post-metadata">

**Author:** ![igouy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ce7236/32.png) [@igouy](https://www.ruby-forum.com/u/igouy)\
**Post date:** [October 7, 2007, 10:00pm UTC](https://www.ruby-forum.com/t/re-ruby-vs-php/116591/4 "2007-10-07T22:00:20Z")

</div>

Isaac G. wrote:

> — “M. Edward (Ed) Borasky” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > If there are things I should throw out, let me know and I’ll re-run  
> > the plots.
> 
> hello
> 
> The more interesting approach would be how can we fix the other failing  
> programs so you don’t need to throw stuff out - is it that hard to fix  
> fannkuch, nsieve-bits, recursive and reverse-complement for Ruby Core?

I haven’t looked at them. My focus until mid-November or thereabouts is  
stuff that already runs on Ruby 1.8.6-p110. 🙂

I also threw out some things that didn’t run on PHP, etc. – it’s not  
just Ruby Core.

Just for the sake of amusement, here’s the complete R code that reads  
your “ndata.csv” file and makes all the numbers and pictures. It runs  
with R-2.6.0, but it might work with older versions. “reshape” and  
“Hmisc” are contributed library packages that don’t come with the base  
R, but can be obtained once you’ve installed R by doing (as “root” on a  
Unix system):

# R

> install.packages(c(“reshape”,“Hmisc”))

It will ask you for a CRAN mirror. If you’ve installed the “rsruby” gem,  
you can do all this from a Ruby program, or maybe even from “irb”.

And yes, all of this magic will work on your Gentoo systems, since it  
works on _my_ Gentoo systems. 🙂
