View Source Benchee.Formatters.HTML (benchee_html v1.0.1)

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.Console,
    {Benchee.Formatters.HTML, file: "samples_output/flat_map.html"}
  ]
)

Summary

Functions

Transforms the statistical results from benchmarking to html reports.

Writes the output of Benchee.Formatters.HTML.format/2 to disk.

Functions

@spec format(Benchee.Suite.t(), map()) :: [{[String.t()], String.t()}]

Transforms the statistical results from benchmarking to html reports.

Returns a map from file name/path to file content. This list is ready to be put into Benchee.Utility.FileCreation.each/3. It's a list of names to be "interleaved" with a main file name that points to the contents of the file. For example:

%{["big list", "flat_map"] => "...file content..."}
@spec write(%{required(Benchee.Suite.key()) => String.t()}, map()) :: :ok

Writes the output of Benchee.Formatters.HTML.format/2 to disk.

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)