[Rcpp-devel] Data Persistence with Rcpp
Christian Gunning
xian at unm.edu
Thu Sep 8 12:36:01 CEST 2011
On Wed, Sep 7, 2011 at 3:13 PM,
<rcpp-devel-request at r-forge.wu-wien.ac.at> wrote:
> The question absolutely pertains to using the inline functionality.
I think this is a reasonable R/C++ question -- i.e. Rcpp. inline is
more or less orthogonal to Rcpp. inline is a great Rcpp jump-starter.
> As each new data arrives, I want to pass it to my C++ function.
After thinking about this for a bit, this might be a reasonable use
case for an Rcpp-module. You can instantiate a module as an R object,
it will hold state, and can be easily updated, queried, etc. The key
weakness here is that modules can't at present be serialized via
save()/load(). So, if you can do all your processing in one R
session, you might want to take a look at this. The code ends up
clean and powerful. I've been headed this way myself for
computationally extensive simulations that depend on time-varying
parameters residing in R dataframes.
Incidentally, an important question to ask yourself is: where are
your bottlenecks? It wasn't clear to me in reading your question
*why* you need C++. The most popular use-case of Rcpp seems to be the
huge speed advantage. Where/why do you need speed? This should
highlight the code that needs to get pushed into C++. R can compete
with compiled code in plenty of cases...
-xian
--
A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
More information about the Rcpp-devel
mailing list