Skip to content

Latest commit

 

History

History
93 lines (61 loc) · 2.49 KB

Readme.md

File metadata and controls

93 lines (61 loc) · 2.49 KB

BenchmarkPlots.jl

Benchmark functions with different amount of data and plot in one figure.

codecov

Install

In Julia REPL

]add BenchmarkPlots

Usage

Basic

using BenchmarkTools, Makie
fig, df = benchmarkplot(
    [sum, minimum],
    rand,
    [10^i for i in 1:4],
)
display(fig)
display(df)
Makie.save("benchmark_sum_miminum.png", fig)

More info

help?> benchmarkplot
search: benchmarkplot benchmarkplot! BenchmarkPlots benchmark BenchmarkTools

  benchmarkplot(Functions::Array, Names::Array, gen::Union{Function,Array}, NumData::Array; kw...)

  Benchmark multiple Functions using different lengths of data generated by function gen. NumData is an Array or other iteratables. Returns a   
  Tuple of (fig, df).

  Core Algorithm
  ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

  For each element in NumData:

    1. gen generates data with length corresponded

    2. BenchmarkTools.@benchmark tunes each function in Functions and restore timings in an array

    3. Plot figure

  Keywords
  ≡≡≡≡≡≡≡≡≡≡

    •  title: figure title. Default is "Benchmark"

    •  logscale: If true, plot axes in log10 scale. Default is true.

    •  xlabel: label of x-axis. Default is logscale ? "log10(N)" : "N"

    •  ylabel: label of y-axis. Default is logscale ? "log10(Timing [ns])" : "Timing [ns]"

    •  resolution: figure resolution. Default is (1600, 900)

    •  Names: alternative names of testing functions. Default is string.(Functions), which is exactly the same with function names

    •  colors: colors of each benchmark line. Default is nothing, meaning random colors are assigned to lines.

    •  savelog::Bool: If true, save processed data in csv. The name of logging file depends on analysis function

    •  savefolder: set the directory to save logging file

    •  stairplot: If true, plot line in stair style (which is more concrete). Default is true

    •  legend: If tree, add legend to the plot

    •  loadfromfile: Path to the file of benchmark result. If nothing, run a new benchmark.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  using BenchmarkPlots, Makie
  fig, df = benchmarkplot(
      [sum, minimum],
      rand,
      [10^i for i in 1:4],
  )
  display(fig)
  display(df)
  Makie.save("benchmark_sum_miminum.png", fig)