[R] An "R is slow"-article

Marc Schwartz marc_schwartz at comcast.net
Wed Jan 9 17:05:16 CET 2008


Barry Rowlingson wrote:
> 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?
> 
>   I don't think it is. He's comparing some C code with calling 
> fisher.test() from R, which he claims does 'nothing but call C code over 
> and over'. Wrong. It checks its arguments in R, it checks for multiple 
> arguments, it does all sorts of goodness before finally calling 
> .C("fexact"). And then it does even more things. Confidence intervals, 
> odds ratios, p-values and so on.
> 
>   He needs to re-run his tests but instead of calling fisher.test() he 
> should prepare the data and call .C("fexact",...) directly.
> 
>> 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
> 
>   And of course C is good at buffer overflows and memory leaks and 
> spending ages compiling when you really just want to do fisher.test(foo) 
> and have done with it.
> 
>   He says: "I used to have a simulation written in R calling compiled C 
> that took overnight to process 100 agents, but now that it's all in C 
> simulations with 9,000 agents run in forty minutes. Don't risk it--learn 
> to do statistical computing in C today!". Fine, but I imagine his R code 
> was created much quicker than the C code. R is quicker to write, and 
> once you have established that your code is running too slow for you, 
> then you optimise. By that point you've hopefully debugged your 
> algorithm and spotted all the nasty traps that would have tied you up in 
> the C debugger for a week. You then rewrite in pure C for speed, and you 
> of course have a set of test cases generated from R to verify your C is 
> doing the same as your R. Win win.
> 
>   He claims to be an economist but clearly doesn't recognise the economy 
> of rapid development...
> 
> Barry

If support list activity is any surrogate measure of the success of his
arguments, that there are 7 subscribers and only 2 posts (both by the
same person and without a reply from the application author) on the
Apophenia e-mail lists at:

  https://sourceforge.net/mail/?group_id=130901

one would hypothesize that he has been less than persuasive...

What color is the sky in his world?

;-)

Regards,

Marc Schwartz




More information about the R-help mailing list