Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add block param for benchmarks to allow them to do their own looping.
This helps in the case that a benchmark had some expensive setup. Previously, * The setup could be done once, outside the benchmark: expensive_setup() tach("method1") do # code to benchmark end * The setup could be done every test, skewing the benchmark: tach("method2") do expensive_setup() # code to benchmark end With this change, you have a third option. * The setup is done once, and the benchmark loops itself: tach("method3") do |n| expensive_setup() n.times do # code to benchmark end end One unfortunate side-effect of this is that using the new syntax will result in lower benchmark scores because of avoiding the overhead of calling a block multiple times.
- Loading branch information