[R] An "R is slow"-article

Robin Hankin r.hankin at noc.soton.ac.uk
Wed Jan 9 17:03:48 CET 2008

Hello Gustaf, List.

Thanks Gustaf for your post!

well I am working pretty intensively with fisher.test() right now, as
some of you will know.

The comparison is not fair:  R's fisher.test() does a whole
bunch of error checking and testing for the size of the
input matrix and assessing of other arguments, and
puts together a nice little list of class "htest".

The C routine does none of this.

The clincher is that fisher.test() as called gives an estimate
for the odds ratio using uniroot() to numerically solve an
equation in terms of the hypergeometric probability
distribution.  This takes a looooonnnngggg time, but
one doesn't notice it in a standard R session.

Sorry, but the time comparison is simply not worth reporting.

On 9 Jan 2008, at 15:25, Gustaf Rydevik wrote:

> Hi all,
> Reading the wikipedia page on R, I stumbled across the following:
> http://fluff.info/blog/arch/00000172.htm
> It does seem interesting that the C execution is that much slower from
> R than from a native C program. Could any of the more technically
> knowledgeable people explain why this is so?
> The author also have some thought-provoking opinions on R being
> no-good and that you should write everything in C instead (mainly
> because R is slow and too good at graphics, encouraging data
> snooping). See  http://fluff.info/blog/arch/00000041.htm
> While I don't agree (granted, I can't really write C), it was
> interesting to read something from a very different perspective than
> I'm used to.
> Best regards,
> Gustaf
> _____
> Department of Epidemiology,
> Swedish Institute for Infectious Disease Control
> work email: gustaf.rydevik at smi dot ki dot se
> skype:gustaf_rydevik
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

More information about the R-help mailing list