# Gives a count for how many times each test was the fastest out of all the reps. 

library(benchmark)
results <- lapply(seq(50), function(i)
benchmark(sqrt(d[,1]^2+d[,2]^2),
          sqrt(d$x^2+d$y^2),
          with(d,sqrt(x^2+y^2)),
          replications=250, order="relative")[,c("test", "relative","elapsed")])
          
          
toTest <- results[[1]][,1]


sapply(toTest, function(test) sum(sapply(results, function(r) r[[1]][1]==test)))

