Le 12/12/2018 à 02:25, Mark Leeds a écrit :
Just to close this thread out, I did a more comprehensive benchmark
using 8 different approaches
and it looks like
A) Jan's solution using memcopy and NumericVector.
B) A push_front solution using NumericVector
C) Serguei's const trick solution u
Just to close this thread out, I did a more comprehensive benchmark using 8
different approaches
and it looks like
A) Jan's solution using memcopy and NumericVector.
B) A push_front solution using NumericVector
C) Serguei's const trick solution using NumericVector
are the top 3 solutions in te
Serguei: Since you were kind enough to time things in my previous question,
I just wanted to follow up with something
I found interesting. I take your code below and only change it in that use
a NumericVector instead of an std::double
and call it mybar3. Somewhat surprisingly, the timing improved
c
Thanks Jeff. I'll check those out. I recently found a gist of Gabor that
explains the relation
between Rcpp and the concept of pointers in C.
https://gist.github.com/ggrothendieck
On Mon, Dec 10, 2018 at 11:29 AM Jeff Newmiller
wrote:
> The archives probably weren't what Mark was hoping for, t
Hi Serguei: Thanks for the link but I was talking about how one would
understand that
my original Rcpp code was about as memory inefficient as one could possibly
get. I
knew it was ugly but not inefficient.
If there are specific threads that discuss the topic, those are fine also.
Mark
On Mon,
The archives probably weren't what Mark was hoping for, though they are good
medicine. Reading the R documentation [1] is probably also good medicine that
Mark is hoping (in vain) to avoid. And then there is the topic of conventional
C++ memory handling, which is relevant but for which there are
Le 10/12/2018 à 16:48, Mark Leeds a écrit :
...
Oh, as I said, the documentation on Rcpp is incredible but is there
anything discussing memory because
I'm pretty lost on that. Thanks again.
Are you talking about this list archives?
http://lists.r-forge.r-project.org/pipermail/rcpp-devel/
Sergu
Thanks to all for all the great repliies. I have to go through them but it
sounds like memcopy
is the best so I'll probably ending use that. Amazing to be part of this
list and receive all of
this wisdom.
Oh, as I said, the documentation on Rcpp is incredible but is there
anything discussing memo
Le 10/12/2018 à 13:04, Jan van der Laan a écrit :
Small addendum: A large part of the performance gain in my example comes
from using NumericVector instead of std::vector. Which avoids a
conversion. An example using std::copy with Numeric vector runs in the
same time as the version using memcpy
On 10 December 2018 at 13:04, Jan van der Laan wrote:
| Small addendum: A large part of the performance gain in my example comes
| from using NumericVector instead of std::vector. Which avoids a
| conversion. An example using std::copy with Numeric vector runs in the
| same time as the version
Small addendum: A large part of the performance gain in my example comes
from using NumericVector instead of std::vector. Which avoids a
conversion. An example using std::copy with Numeric vector runs in the
same time as the version using memcpy.
Jan
On 10-12-18 12:28, Jan van der Laan wrot
For performance memcpy is probably fastest. This gives the same
performance a c().
// [[Rcpp::export]]
NumericVector mybar3(NumericVector x, double firstelem) {
NumericVector result(x.size() + 1);
result[0] = firstelem;
std::memcpy(result.begin()+1, x.begin(), x.size()*sizeof(double));
Le 09/12/2018 à 09:35, Mark Leeds a écrit :
Hi All: I wrote below and it works but I have a strong feeling there's a
better way to do it.
If performance is an issue, you can save few percents of cpu time by
using std::copy() instead of explicit for loop. Yet, for this operation
R's c() remains
Hi All: I wrote below and it works but I have a strong feeling there's a
better way to do it. I looked on the net and found some material from back
in ~2014 about concatenating
vectors but I didn't see anything final about it. Thanks for any insights.
Also, the documentation for Rcpp is beyond inc
14 matches
Mail list logo