Session Ready
Exercise

Task size matters

Now you will benchmark the functions created in the previous exercise using the microbenchmark package. To see the impact of the parallel processing overhead, you will pass different number of replications and sample sizes and explore under which conditions parallel processing becomes inefficient.

mean_of_rnorm_sequentially(), mean_of_rnorm_in_parallel(), and a cluster cl with two nodes are available.

Instructions 1/2
undefined XP
  • 1
    • Set n_numbers_per_replicate to five million and n_replicates to 4.
    • In the microbenchmark, compare the expressions mean_of_rnorm_sequentially() and mean_of_rnorm_in_parallel(), both with calls to n_numbers_per_replicate and n_replicates
    • Look at the benchmark results. Which is faster?
    • 2
      • Change n_numbers_per_replicate to 100 and n_replicates to 100.
      • Run the microbenchmark() again.
      • Look at the benchmark results. Which is faster this time?