Re:R, the master troll of statistical languages (2012)
by gbrown on Tuesday February 16, 2016 @06:01PM
(#11113800)
R does actually ship with the ability to byte-compile functions these days, and as that functionality matures it may become the default behavior. It's still better to actually learn the language; it's far easier to optimize something like:
than:
[ Parent
| on HN ]
Re:R, the master troll of statistical languages (2012)
by klmr on Tuesday February 16, 2016 @07:34PM
(#11114254)
As far as I know byte-compiling won’t actually alleviate the repeated name lookup (or does it?). Unless the R byte compiler is fiendishly clever, every single name lookup in the loop body will still incur what essentially amounts to a `get(name, environment(), inherits = TRUE)` call.
Re:R, the master troll of statistical languages (2012)
by gbrown on Tuesday February 16, 2016 @08:49PM
(#11114589)
Probably not, but I'll admit to not having dug into it too deeply. In my initial experiments, I found only modest speed gains when byte compiling. Then again, I'm already using C functions wherever possible.