Displaying 2 results from an estimated 2 matches for "elapsed2".
Did you mean:
elapsed
2015 Sep 09
0
sample.int() algorithms
...1e7, 1e8, 1e9),
sampleSizeList=c(10, 100, 1000, 10000),
numReplications=1000) {
for (sampleSize in sampleSizeList) {
for (popSize in popSizeList) {
elapsed1 = system.time(replicate(numReplications,
sample.int(popSize, sampleSize)))[["elapsed"]]
elapsed2 = system.time(replicate(numReplications,
.Internal(sample2(popSize, sampleSize))))[["elapsed"]]
cat(sprintf("Sample %d from %.0e: %f vs %f seconds\n",
sampleSize, popSize, elapsed1, elapsed2))
}
cat("\n")
}
}
compareSampleTimes()
https...
2012 Jul 13
1
functions of vectors : loop or vectorization
...c, d, v.myfunction2);
all.equal(myresults,outer(c, d, v.myfunction2));
[1] TRUE
I was quite happy with my trick of separating and wrapping the functions
until I increased the size of the two input vectors and checked for the
processing time. I made no gain. In that case :
> time.elapsed; time.elapsed2;
Time difference of 0.08000016 secs
Time difference of 0.07999992 secs
When I changed the size of the vectors and added a logarithm here and there
to complicate a bit, it doesn't change the problem. The two methods perform
identically. Am I missing something ? Is there a better way to vectoriz...