From 095e5278d2ea006ba659c5c34f90ba14e16aaaee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20W=C3=B3jtowicz?= Date: Sun, 29 May 2016 17:57:09 +0200 Subject: [PATCH] changed sample benchmark --- benchmark-sample.R | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/benchmark-sample.R b/benchmark-sample.R index a9d655d..414f831 100644 --- a/benchmark-sample.R +++ b/benchmark-sample.R @@ -1,15 +1,18 @@ -library(rbenchmark) +runs = 10 f = function() { -set.seed (1) -m <- 1000 -n <- 500 -A <- matrix (runif (m*n),m,n) + set.seed (1) + m <- 4000 + n <- 4000 + A <- matrix (runif (m*n),m,n) -# Matrix multiply -B <- crossprod(A) + # Matrix multiply + B <- crossprod(A) } -print(benchmark(f(), replications=100)) - +cumulate = 0 +for (i in 1:runs) + cumulate = cumulate + as.numeric(system.time(f())[3]) + +cat(paste0(round(cumulate/runs, 3), "\n"))