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

Scott Kostyshak skostysh at princeton.edu
Fri Apr 25 17:38:40 CEST 2014

On Thu, Apr 24, 2014 at 4:32 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
> Scott,
> My first quick hunches are a) 50% is too much for compiler switches, b) your
> examples shows R code, and c) are you sure you are using the same BLAS?

Thanks for the quick reply Dirk and for the suggestions.

As for BLAS, yes I believe I'm using the same BLAS. The output of the
following two commands is the same (except for the memory addresses of
$ ldd /usr/local/lib/R-devel/lib/R/bin/exec/R
$ ldd /usr/lib/R/bin/exec/R

And executing
$ lsof -p <PID> | grep 'blas\|lapack'
also returns the same output for both Rs:
R       13017 scott  mem    REG    8,1  9142768 2097161
R       13017 scott  mem    REG    8,1  3776592 2097162

I profiled and it seems that all of the R functions are slow (I can
post the output if anyone is interested). I rebuilt with -O3 in CFLAGS
and this improved things a lot. Time went down from 10 seconds to 5.7
or so. I reprofiled and again the R functions of R-devel seem just a
tad slower across the board (I can send output if interested).

Below are some timings comparing the optimized R-devel to R.

$ time R-devel CMD BATCH mwe.R

real 0m5.755s
user 0m5.678s
sys 0m0.079s

$ time R CMD BATCH mwe.R

real 0m5.453s
user 0m5.371s
sys 0m0.054s

Rerunning the above commands multiple times gives about the same output.

There's still a .3 second difference and I'm curious to know why. Any ideas?


Scott Kostyshak
Economics PhD Candidate
Princeton University

More information about the R-SIG-Debian mailing list