1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| ## Pour une expression simple :
> system.time(for(i in 1:100) mad(runif(1000)))
utilisateur système écoulé
0.06 0.00 0.07
## Pour des bouts de code plus conséquents :
> ptm <- proc.time()
> for (i in 1:50) mad(stats::runif(500))
> proc.time() - ptm
utilisateur système écoulé
0.03 0.00 0.22
## Pour voir en détail le temps passé dans les sous-fonctions :
> Rprof()
> for (i in 1:50) mad(stats::runif(500))
> Rprof(NULL)
> summaryRprof()
$by.self
self.time self.pct total.time total.pct
mean 0.02 50 0.04 100
mean.default 0.02 50 0.02 50
mad 0.00 0 0.04 100
median 0.00 0 0.04 100
median.default 0.00 0 0.04 100
$by.total
total.time total.pct self.time self.pct
mean 0.04 100 0.02 50
mad 0.04 100 0.00 0
median 0.04 100 0.00 0
median.default 0.04 100 0.00 0
mean.default 0.02 50 0.02 50
$sampling.time
[1] 0.04 |