3 ms·
Does this mean simple for-loops in R will be faster? Currently R can be order(s) of magnitude slower than MATLAB / Python. Does one have to do something specifi
by plg 9y ago
Does this mean simple for-loops in R will be faster? Currently R can be order(s) of magnitude slower than MATLAB / Python. Does one have to do something specific to use the JIT or is it automagic?
- jmount 9y agoSpeed differences of that magnitude are largely due to bad interactions with R's data allocation model. R for loops are not that slow if there is no allocation going on, and there are ways to organize the allocation ahead of time: http://www.win-vector.com/blog/2015/07/efficient-accumulation-in-r/ http://www.win-vector.com/blog/2015/07/efficient-accumulatio... So my guess is: no the JIT won't help for ultra slow code as in my experience that isn't the problem in that case.
- yread 9y agoReally nice article, shows why writing fast R code is such a pain. I had no idea that data frame is that much worse than data table.
- haddr 9y agoWhile this is a great article, it also transmits some truth about R: writing anything fast is a pain in the ass. Especially frustrating when you hear those R "experts" repeating "use apply" functions. The truth is, the design of the language requires you to actually learn some dirty details and NOT solely rely on the idiomatic syntax. I like R quite much, but this is a sign of a bad language design.