[R] compiling functions....
@@r@h@go@|ee @end|ng |rom gm@||@com
Thu Jun 21 15:29:45 CEST 2018
There are many things you can do to improve speed in R. Byte compiling
is just one of them.
This chapter in Hadley Wickham's excellent Advanced R book covers both
profiling and byte compiling.
I've gotten some stunning improvements in speed through profiling and
careful thought: 3 days to 3 seconds, even.
On Thu, Jun 21, 2018 at 6:28 AM, akshay kulkarni <akshay_e4 using hotmail.com> wrote:
> dear members,
> I a Day Trader based in INDIA. I use R for my research. I have a function ygusa(snlq,snlcqn) which takes 208 stocks and returns 4 best stocks for the next day(snlq is the list of 208 stocks and snlcqn is their names). However, the execution time is around 2 hrs, making it hard for me.
> I recently read in the internet that you can precompile the code in R to make it run faster. Also that you can enable JIT(just in time compilation) from your R session automatically. I came to know that R 3.4.x has JIT enabled in it by default. Is it true? Is it also true that even after enabling JIT in R 3.4.x, the first run of a function is not Byte compiled?
> So when I start my R session, download the data, and run ygusa(snlq,snlcqn), it is not byte compiled and therefore it is very slow? Will including the following lines in ygusa solve my problem:
> Also, instead of compiling the function ygusa every time I run it, can I compile it once and store it, and run that compiled file instead of ygusa(snlq,snlcqn)?
> Can you point me to some online resources that can help on this issue?
> very many thanks for your time and effort...
> Yours sincerely,
> AKSHAY M KULKARNI
More information about the R-help