ripley at stats.ox.ac.uk
Tue Apr 16 17:22:14 CEST 2002
On 16 Apr 2002, Timothy H. Keitt wrote:
> This seems entirely reasonable. We shouldn't expect a language like R to
> deliver native high performance computing; its value is as a layer above
> highly optimized C/Fortran/other code, e.g. Atlas. Probably, the biggest
> short term gain in performance would be to implement parallel versions
> (threads, pvm, mpi) of apply and friends. I've lately been getting up to
> 10x performance improvements after replacing explicit loops with lapply
> statements called on closures.
Careful! They are running (arbitrary) R code, and Luke's caveats apply.
Internally lapply does an eval(), and we can't have more than one of
those running at once without all the perils of user R-level threads,
as I understand it.
apply() is expensive because of the checking/housekeeping it does, and so
it seems not worthwhile re-writing it in internal code, whereas it was
worth it for lapply. Generally if an apply call is expensive, see if it
can (easily) be rewritten with lapply.
> On Tue, 2002-04-16 at 07:29, Luke Tierney wrote:
> > in my view, highly unlikely that these R level threads will be able to
> > run in parallel any time soon, if ever. At least initially it is
> > almost certain that we will have to use an approach similar to the one
> > used in Python and have a global lock that makes sure at most one
> > threads is running in R code at any given time. (There will be context
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help