Skip to content

JuliaAstroSim/BenchmarkPlots.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages