[R] More simple implementation is slow.
wl2776
wl2776 at gmail.com
Sat Jun 9 13:16:23 CEST 2012
Sorry, here are the profiles:
summaryRprof("get_tau")
$by.self
self.time self.pct total.time total.pct
"cbind" 0.02 50 0.04 100
"unlist" 0.02 50 0.02 50
$by.total
total.time total.pct self.time self.pct
"cbind" 0.04 100 0.02 50
"get_tau" 0.04 100 0.00 0
"unlist" 0.02 50 0.02 50
"apply" 0.02 50 0.00 0
$sample.interval
[1] 0.02
$sampling.time
[1] 0.04
summaryRprof("get_tau2")
$by.self
self.time self.pct total.time total.pct
"FUN" 0.48 51.06 0.84 89.36
"$" 0.34 36.17 0.34 36.17
"ls" 0.08 8.51 0.08 8.51
"+" 0.02 2.13 0.02 2.13
"lapply" 0.02 2.13 0.02 2.13
$by.total
total.time total.pct self.time self.pct
"apply" 0.86 91.49 0.00 0.00
"get_tau2" 0.86 91.49 0.00 0.00
"FUN" 0.84 89.36 0.48 51.06
"$" 0.34 36.17 0.34 36.17
"ls" 0.08 8.51 0.08 8.51
"apropos" 0.08 8.51 0.00 0.00
".completeToken" 0.08 8.51 0.00 0.00
"normalCompletions" 0.08 8.51 0.00 0.00
"+" 0.02 2.13 0.02 2.13
"lapply" 0.02 2.13 0.02 2.13
"unlist" 0.02 2.13 0.00 0.00
$sample.interval
[1] 0.02
$sampling.time
[1] 0.94
I also was advised to use
with(cpt, sqrt(outer(x, x, "-")^2 + outer(y, y, "-")^2) )
And here is its profile
summaryRprof("with")
$by.self
self.time self.pct total.time total.pct
"gsub" 0.02 100 0.02 100
$by.total
total.time total.pct self.time self.pct
"gsub" 0.02 100 0.02 100
".completeToken" 0.02 100 0.00 0
"grep" 0.02 100 0.00 0
"keywordCompletions" 0.02 100 0.00 0
"makeRegexpSafe" 0.02 100 0.00 0
"normalCompletions" 0.02 100 0.00 0
"sprintf" 0.02 100 0.00 0
$sample.interval
[1] 0.02
$sampling.time
[1] 0.02
Apparently, it is about twise faster.
--
View this message in context: http://r.789695.n4.nabble.com/More-simple-implementation-is-slow-tp4632872p4632881.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list