[Rd] .C(..., DUP=FALSE) memory costs depending on input size?
MarcelK
m_kempenaar at planet.nl
Fri Nov 7 09:18:45 CET 2008
Thank you for your answer William.
I've tried the parameter NAOK out and this is the result:
(RED: FALSE, GREEN: TRUE)
http://www.nabble.com/file/p20376259/RandC_2.png
As you can see the green line is almost flat now, at least a lot better then
when disabling this option.
Still there is something causing the line to be not completely flat.
Although I suspect some of this is because of the timing function (is there
any other, more accurate, timing function in R besides system.time()?) it
still looks depending on vector size.
Numeric output:
NAOK=FALSE:
----------------
[1] 0.000 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.011 0.012
[13] 0.012 0.014 0.014 0.015 0.017 0.018 0.019 0.020 0.021 0.021 0.023 0.024
[25] 0.025 0.026 0.027 0.028 0.029 0.030 0.031 0.032 0.033 0.034 0.035 0.036
[37] 0.038 0.038 0.039 0.041 0.042 0.043 0.044 0.045 0.046 0.046 0.048 0.049
[49] 0.050 0.050 0.052 0.053 0.054 0.055 0.056 0.057 0.058 0.060 0.060 0.061
[61] 0.063 0.063 0.065 0.065
NAOK=TRUE:
---------------
[1] 0.000 0.000 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001
[13] 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.003 0.002 0.003 0.002 0.002
[25] 0.003 0.003 0.003 0.003 0.003 0.003 0.004 0.003 0.004 0.003 0.004 0.004
[37] 0.004 0.004 0.004 0.004 0.004 0.004 0.005 0.005 0.005 0.005 0.005 0.005
[49] 0.005 0.006 0.006 0.005 0.006 0.006 0.006 0.006 0.006 0.006 0.006 0.007
[61] 0.006 0.007 0.007 0.008
Input sizes:
-------------
[1] 512 131584 262656 393728 524800 655872 786944 918016 1049088
[10] 1180160 1311232 1442304 1573376 1704448 1835520 1966592 2097664 2228736
[19] 2359808 2490880 2621952 2753024 2884096 3015168 3146240 3277312 3408384
[28] 3539456 3670528 3801600 3932672 4063744 4194816 4325888 4456960 4588032
[37] 4719104 4850176 4981248 5112320 5243392 5374464 5505536 5636608 5767680
[46] 5898752 6029824 6160896 6291968 6423040 6554112 6685184 6816256 6947328
[55] 7078400 7209472 7340544 7471616 7602688 7733760 7864832 7995904 8126976
[64] 8258048
Thanks again for the advice, helped me a lot.
And yes, I will be looking at using .Call() or .External(), but since the
learning curve is a bit steep and I'm currently only making a proof of
concept, .C() will do fine for now.
(P.S. I posted this using Nabble, so layout in e-mail might be a bit
awkward..)
William Dunlap wrote:
>
>
> Does using NAOK=TRUE in the .C() help? That would avoid
> an NA-scan of the input vectors.
>
> Bill Dunlap
> TIBCO Spotfire Inc
> wdunlap tibco.com
>
>
--
View this message in context: http://www.nabble.com/.C%28...%2C-DUP%3DFALSE%29-memory-costs-depending-on-input-size--tp20368695p20376259.html
Sent from the R devel mailing list archive at Nabble.com.
More information about the R-devel
mailing list