https://github.com/juliaastrosim/benchmarkplots.jl
https://github.com/juliaastrosim/benchmarkplots.jl
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/juliaastrosim/benchmarkplots.jl
- Owner: JuliaAstroSim
- License: gpl-3.0
- Created: 2021-04-22T11:10:36.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-07-01T02:08:00.000Z (12 months ago)
- Last Synced: 2025-07-01T03:24:24.852Z (12 months ago)
- Language: Julia
- Size: 118 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# BenchmarkPlots.jl
Benchmark functions with different amount of data and plot in one figure.
[](https://codecov.io/gh/JuliaAstroSim/BenchmarkPlots.jl)
## Install
In `Julia` `REPL`
```julia
]add BenchmarkPlots
```
## Usage
### Basic
```julia
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
```julia
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)
```