Skip to content

Commit

Permalink
Ok just reuse the main_function from Runner for now
Browse files Browse the repository at this point in the history
  • Loading branch information
PragTob committed May 11, 2018
1 parent acec2fa commit 95ef82c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 2 additions & 7 deletions lib/benchee/benchmark/repeated_measurement.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -131,17 +131,12 @@ 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,
iterations
)
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
4 changes: 2 additions & 2 deletions lib/benchee/benchmark/runner.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 95ef82c

Please sign in to comment.