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. http://adv-r.had.co.nz/Profiling.html I've gotten some stunning improvements in speed through profiling and careful thought: 3 days to 3 seconds, even. Sarah On Thu, Jun 21, 2018 at 6:28 AM, akshay kulkarni <akshay...@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: >> require(compiler) >> enableJIT(3) > > ? > > 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 > -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.