From 95ef82cba4e8555f2b5a3a3b8dc4d96addca1a57 Mon Sep 17 00:00:00 2001 From: Tobias Pfeiffer Date: Fri, 11 May 2018 13:24:57 +0200 Subject: [PATCH] Ok just reuse the main_function from Runner for now --- lib/benchee/benchmark/repeated_measurement.ex | 9 ++------- lib/benchee/benchmark/runner.ex | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/benchee/benchmark/repeated_measurement.ex b/lib/benchee/benchmark/repeated_measurement.ex index 7c05a917..94fd7912 100644 --- a/lib/benchee/benchmark/repeated_measurement.ex +++ b/lib/benchee/benchmark/repeated_measurement.ex @@ -116,7 +116,7 @@ defmodule Benchee.Benchmark.RepeatedMeasurement do } ) when iterations > 1 do - main = main_function(function, input) + main = Runner.main_function(function, input) # with no before/after each we can safely omit them and don't get the hit # on run time measurements (See PR discussions for this for more info #127) fn -> RepeatN.repeat_n(main, iterations) end @@ -131,7 +131,7 @@ defmodule Benchee.Benchmark.RepeatedMeasurement do RepeatN.repeat_n( fn -> new_input = Hooks.run_before_each(scenario, scenario_context) - main = main_function(function, new_input) + main = Runner.main_function(function, new_input) return_value = main.() Hooks.run_after_each(return_value, scenario, scenario_context) end, @@ -139,9 +139,4 @@ defmodule Benchee.Benchmark.RepeatedMeasurement do ) end end - - # TODO: temporarily duplicated - @no_input Benchee.Benchmark.no_input() - defp main_function(function, @no_input), do: function - defp main_function(function, input), do: fn -> function.(input) end end diff --git a/lib/benchee/benchmark/runner.ex b/lib/benchee/benchmark/runner.ex index d810e36b..42474851 100644 --- a/lib/benchee/benchmark/runner.ex +++ b/lib/benchee/benchmark/runner.ex @@ -212,6 +212,6 @@ defmodule Benchee.Benchmark.Runner do end @no_input Benchmark.no_input() - defp main_function(function, @no_input), do: function - defp main_function(function, input), do: fn -> function.(input) end + def main_function(function, @no_input), do: function + def main_function(function, input), do: fn -> function.(input) end end