[R] Speeding up small functions

Gabor Grothendieck ggrothendieck at gmail.com
Sun Nov 19 22:40:56 CET 2006

Try a test in which you replace the function calls with inline
code and compare the two speed-wise.  You may very well
find that the difference is inconsequential.

On 11/19/06, Wee-Jin Goh <wjgoh at brookes.ac.uk> wrote:
> Greetings list,
> In my code, I have a few small functions that are called very very
> frequently. An example of one such function is the following :
> sigmoid<-function(x) 1/(1+exp(-x))
> Now, is there anyway to make this go faster? For example, in C++ we
> could make it inline. Is there a corresponding feature in R?
> Cheers,
> Wee-Jin
> ______________________________________________
> R-help at stat.math.ethz.ch 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.

More information about the R-help mailing list