source("sum1.R") source("sum2.R") dyn.load("sum2.so") comp_sum_funcs <- function(sizes){ msizes = c() times_1 = c() times_2 = c() for(i in sizes) { m <- matrix(rnorm(i^2), i) times_1 = append(times_1, summary(system.time(sum1(m)))[1]) times_2 = append(times_2, summary(system.time(sum2(m)))[1]) msizes = append(msizes, i) } return(data.frame(size=msizes, sum_1 = times_1, sum_2 = times_2)) }