-
-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable caching of sourceCpp compilations across R sessions #504
Conversation
Regarding the Travis timeout, I am wrapping the test call in Do we know whether Travis is just slow? We used to get done in about 8 minutes ... so can we be sure it is not the changeset here? |
Apologies in advance for not contributing anything of substance next, but... This is awesome! |
I think that it's the changeset. Here's why: the cache of compiled R Let me think about some possible ways out of this box.... On Mon, Jul 11, 2016 at 1:49 PM, Dirk Eddelbuettel <notifications@github.com
|
Good analysis. In which case we can surely just prefix with At least until we have a better fix. |
Kevin just helped me get to the bottom of things (it was actually a bug The latest commit should get us back to green on Travis. On Mon, Jul 11, 2016 at 2:11 PM, JJ Allaire jj.allaire@gmail.com wrote:
|
Yay yay yay -- I was starting to fear you two would get turned off working on this forever and ever :) |
I just merged #503 which you can probably bring in here too. |
Note that you'll need to update from the Rcpp branch again to try this out. |
Nice work -- using the Fibonacci example referenced by @yihui:
|
I quickly inspected |
I agree that it would be better to use relative paths here however the On Tue, Jul 12, 2016 at 2:22 PM, Yihui Xie notifications@github.com wrote:
|
What happens if you sourceCpp on two files with the same relative name in the same session? After a setwd for instance. |
That will work fine (the cache is keyed by absolute path not relative path). |
Note that this PR doesn't change anything about how the cache works other than it's now stored on disk rather than in memory. For |
What about allowing users to set a cache directory with an R option or something like that? E.g. |
I like that idea. All it would take is to change
to
The second argument ( |
Okay, just added this. On Tue, Jul 12, 2016 at 5:15 PM, Dirk Eddelbuettel <notifications@github.com
|
This too should be ready per the reverse depends check summarized here so I will merge this. |
Cool. The knitr PR was also merged, so ````{Rcpp cache=TRUE}` is ready to be used with the dev versions of knitr and Rcpp now. |
This PR adds a
cacheDir
argument tosourceCpp
to enable caching of shared libraries across R sessions. The argument defaults totempdir()
which emulates the existing default behavior of only caching compilations within the current R session.The implementation changes the storage of the data structure that tracks previous compilations from a static C++ object to disk based storage (a serialized R list) within the specified
cacheDir
.This feature is motivated by the desire to cache
Rcpp
chunks within knitr documents (particularly important for book authoring). See rstudio/bookdown#113 for additional discussion.