benchee_html v0.3.0 Benchee.Formatters.HTML

Functionality for converting Benchee benchmarking results to an HTML page with plotly.js generated graphs and friends.

Examples

list = Enum.to_list(1..10_000)
map_fun = fn(i) -> [i, i * i] end

Benchee.run(%{
  "flat_map"    => fn -> Enum.flat_map(list, map_fun) end,
  "map.flatten" => fn -> list |> Enum.map(map_fun) |> List.flatten end
},
  formatters: [
    &Benchee.Formatters.HTML.output/1,
    &Benchee.Formatters.Console.output/1
  ],
  formatter_options: [html: [file: "samples_output/flat_map.html"]],
)

Summary

Functions

Transforms the statistical results from benchmarking to html to be written somewhere, such as a file through IO.write/2

Given statistics and run times for an input get all the data of a job together

Uses Benchee.Formatters.HTML.format/1 to transform the statistics output to HTML with JS, but also already writes it to files defined in the initial configuration under formatter_options: [html: [file: "benchmark_out/my.html"]]

Functions

format(map)
format(Benchee.Suite.t) :: %{optional(Benchee.Suite.key) => String.t}

Transforms the statistical results from benchmarking to html to be written somewhere, such as a file through IO.write/2.

Returns a map from file name/path to file content.

merge_job_measurements(statistics, run_times)

Given statistics and run times for an input get all the data of a job together.

Exmaples

iex> statistics = %{
...>   "Job"   => %{average: 500.0},
...>   "Other" => %{average: 200.0}
...> }
iex> run_times = %{"Job" => [400, 600], "Other" => [150, 250]}
iex> Benchee.Formatters.HTML.merge_job_measurements(statistics, run_times)
%{
  "Job" => %{
    statistics: %{average: 500.0},
    run_times:  [400, 600]
  },
  "Other" => %{
    statistics: %{average: 200.0},
    run_times: [150, 250]
  }
}
output(map)

Uses Benchee.Formatters.HTML.format/1 to transform the statistics output to HTML with JS, but also already writes it to files defined in the initial configuration under formatter_options: [html: [file: "benchmark_out/my.html"]].

Generates the following files:

  • index file (exactly like file is named)
  • a comparison of all the benchmarked jobs (one per benchmarked input)
  • for each job a detail page with more detailed run time graphs for that particular job (one per benchmark input)