From: "M. Edward (Ed) Borasky" Date: 2007-10-08T04:59:24+09:00 Subject: Re: Ruby vs. PHP --------------010709040905000302010606 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Isaac Gouy wrote: > --- "M. Edward (Ed) Borasky" 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. :) --------------010709040905000302010606 Content-Type: text/plain; name="pivot.R" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pivot.R" rm(list=ls()) # clean memory is happy memory library(reshape) # load the reshaping library library(Hmisc) # utilities ndata <- subset(read.csv("ndata.csv"), # get raw data select=c("test", "iter", "lang", "secs"), secs>0) ndm <- melt(ndata, id.var=c("test", "iter", "lang")) # melt the dataset pivot <- cast(ndm, test + iter ~ lang, sum) # create the base pivot table # column 1 now has the benchmark test name and column 2 has the iteration count # the rest of the columns have the benchmark times for each language dynamic <- na.omit(subset(pivot, select= c("test", "iter", "gcc", "yarv", "python", "perl", "php", "ruby", "jruby"))) n <- ncol(dynamic) # column count ratio <- dynamic # copy the input to preserve shape ratio[3:n] <- ratio[3:n]/dynamic$gcc # ratio with gcc = 1 ln.ratio <- ratio # natural log of ratio ln.ratio[3:n] <- log(ratio[3:n]) # now compute geometric means over all benchmarks for the languages geomeans <- exp(colMeans(ln.ratio[,3:n], na.rm=TRUE)) m <- nrow(ratio) # make plot pdf(width=10, height=7.5, file="shootout.pdf") ratio.boxplot <- boxplot(ratio[3:n], outline=FALSE, ylim=c(0, 500)) graphics.off() pdf(width=10, height=7.5, file="ln-shootout.pdf") ln.ratio.boxplot <- boxplot(ln.ratio[3:n]/log(10), ylab="Log(10) Ratio") graphics.off() ratio.boxplot$stats <- rbind(ratio.boxplot$stats, geomeans) rownames(ratio.boxplot$stats) <- c("Low", "Q1", "Median", "Q3", "High", "GeoMean") colnames(ratio.boxplot$stats) <- colnames(ratio)[3:n] signif(ratio.boxplot$stats, 2) --------------010709040905000302010606--