[R-sig-Debian] 50% performance of custom R build compared to PPA R for a command

Scott Kostyshak skostysh at princeton.edu
Thu Apr 24 22:10:48 CEST 2014


Hi,

I have R installed from the Ubuntu PPA and a local build of R (more
details below). I will refer to these as "R" and "R-devel",
respectively. I've reproduced the following on Ubuntu 13.10 and 14.04.
Below is an example (which requires the bootstrap package) that takes
10 seconds for me to run with R-devel and 5 seconds with R

library(bootstrap)
str(tooth)
theta <- function(ind) {
    easy <- lm(strength ~ E1+E2, data=tooth, subset=ind)
    diffi<- lm(strength ~ D1+D2, data=tooth, subset=ind)
    (sum(resid(easy)^2) - sum(resid(diffi)^2))/13   }
tooth.boot <- bootstrap(1:13, 2000, theta)

I'm wondering if this is due to different compiler flags. For R, when
installing the bootstrap package, I see
gcc -std=gnu99 -shared -Wl,-Bsymbolic-functions -Wl,-z,relro -o
bootstrap.so boott.o -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR

For R-devel I see:
ccache gcc -shared -L/usr/local/lib -o bootstrap.so boott.o -lgfortran
-lm -lquadmath -L/usr/local/lib/R-devel/lib/R/lib -lR

My install script for the local build is based on Dirk's script [1].
In particular, my configure command is:

R_PAPERSIZE=letter R_BATCHSAVE="--no-save --no-restore"
R_BROWSER=xdg-open PAGER=/usr/bin/pager PERL=/usr/bin/perl
R_UNZIPCMD=/usr/bin/unzip R_ZIPCMD=/usr/bin/zip
R_PRINTCMD=/usr/bin/lpr LIBnn=lib AWK=/usr/bin/awk CC="gcc"
CFLAGS="-ggdb -pipe -std=gnu99 -Wall -pedantic" CXX="g++"
CXXFLAGS="-ggdb -pipe -Wall -pedantic" FC="gfortran" F77="gfortran"
MAKE="make -j$NJOBS" "${repoDir}/configure"
--prefix=/usr/local/lib/R-devel --enable-R-shlib --with-blas
--with-lapack --with-readline --without-recommended-packages >
../build-logs/configure 2>&1

I'm using R-devel updated to today's revision but I compiled a version
from a year ago and had the same performance so that is why I suspect
my installation script accounts for the differences.

Any advice would be appreciated and please let me know if any other
information would be helpful.

Best,

Scott

[1]
http://www.personal.psu.edu/mar36/blogs/the_ubuntu_r_blog/2012/08/installing-the-development-version-of-r-on-ubuntu-alongside-the-current-version-of-r.html

--
Scott Kostyshak
Economics PhD Candidate
Princeton University



More information about the R-SIG-Debian mailing list