best practice for writing R codes -
hi had quick question regarding writing faster r scripts using multiple functions: of next run faster assuming same content in each example? functions within functions i.e
function(args) { function_using_previous_function_output(args) { manipulation of arguments} }
functions pass stuff outside of each other:
function(args) {return(output} } function_using_previous_function_output(output) { manipulation of arguments }
is there best practice style or optimisation out of these ??
many thanks!
short answer; you're looking downwards wrong avenue in terms of optimising code.
long answer;
the contents of import aspect of script's performance. should fudging syntax if code parallelised, vectorised, rcpp-ised , byte-compiled (require(compiler);enablejit(3)), , still need more speed.
in unlikely case need alter shape of code gain speed, these articles friend
http://www.r-bloggers.com/speeding-up-r-computations/ http://radfordneal.wordpress.com/2010/08/15/two-surpising-things-about-r/
to reply original question; should determine efficiency using system.time() function; uncertainty there statistically important difference either way
r
No comments:
Post a Comment