Skip to content

Commit 99acc6b

Browse files
committed
Move test value generation to benchmarked expression
Previously, the test value was generated during the "setup" phase. This resulted in benchmarks which were not oranges to oranges comparable. For other languages, we generate new test values for each iteration. Hence, to ensure similar tests, we needed to move test value generation to be part of the benchmark.
1 parent b5a961a commit 99acc6b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

tools/snippets/benchmark/r/benchmark.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@ print_results <- function( elapsed ) {
5959
#' @examples
6060
#' elapsed <- benchmark();
6161
benchmark <- function() {
62-
x <- runif( 1 ); # TODO
63-
6462
# Run the benchmarks:
65-
results <- microbenchmark::microbenchmark( TODO( x ), times = iterations );
63+
results <- microbenchmark::microbenchmark( TODO( TODO ), times = iterations );
6664

6765
# Sum all the raw timing results to get a total "elapsed" time:
6866
elapsed <- sum( results$time );

0 commit comments

Comments
 (0)