[R] R function calling: efficiency of different alternatives
B.Rowlingson at lancaster.ac.uk
Tue Apr 1 13:29:43 CEST 2003
Ramon Diaz wrote:
> I think I recall reading something about differences in efficiency between
> those three approaches, but I can't find the information (I've searched the
> email archives, Venables & Ripley's "S programming" and MASS, the R manuals,
> and Burn's "S Poetry").
> Are there any real performance differences?
I've always worked on the understanding that you should get code
working and then profile it before you think about optimising it.
There's no point worrying about efficiency issues with function calling
strategies if your program is going to be spending 99% of its time doing
those matrix operations and svd calculations.
Do you think the overhead in searching for a function in a few tables,
passing some parameters, and returning, is going to overwhelm the time
taken in all the other calculations? Seems unlikely to me.
Get it working one way or another - preferably with concerns in other
aspects of software engineering (modularity, reusability etc) - and then
if efficiency is a problem then profile the code to see where its
spending its time. If it really is in the function calling mechanism,
and not the guts of the code, then worry.
More information about the R-help