Displaying 2 results from an estimated 2 matches for "elapsed1".
Did you mean:
elapsed
2015 Sep 09
0
sample.int() algorithms
...# compare times for sample.int() vs internal function sample2()
compareSampleTimes = function(popSizeList=c(1e5, 1e6, 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"...
2011 Apr 19
0
doSMP package works better than perfect, at least sometimes.
...,mean, na.rm=TRUE
)
,by=c('g','n','method')
)
# transpose to wide
mm <- melt(stats, id=c('g','n','method'))
tstats <- dcast(mm, g + n ~ variable+method)
tstats$speedup.elapsed1 <- tstats$meanElapsed_unvectorized /
tstats$meanElapsed_1CoreVectorized
tstats$speedup.elapsed3 <- tstats$meanElapsed_1CoreVectorized /
tstats$meanElapsed_SMPVectorized
speedupVectorizing <- dcast(tstats[c('g','n','speedup.elapsed1')], g~n,
value_var='...