diff --git a/lib/benchee/system.ex b/lib/benchee/system.ex index 9e2d946d..d1dadece 100644 --- a/lib/benchee/system.ex +++ b/lib/benchee/system.ex @@ -20,6 +20,8 @@ defmodule Benchee.System do cpu_speed: cpu_speed() } + warn_about_performance_degrading_settings() + %Suite{suite | system: system_info} end @@ -164,4 +166,22 @@ defmodule Benchee.System do output end end + + defp warn_about_performance_degrading_settings do + unless all_protocols_consolidated?() do + IO.puts(""" + Not all of your protocols have been consolidated. In order to achieve the + best possible accuracy for benchmarks, please ensure protocol + consolidation is enabled in your benchmarking environment. + """) + end + end + + defp all_protocols_consolidated? do + path = :code.lib_dir(:elixir, :ebin) + + [path] + |> Protocol.extract_protocols() + |> Enum.all?(&Protocol.consolidated?/1) + end end