diff --git a/benchmark/benchmarks.jl b/benchmark/benchmarks.jl new file mode 100644 index 0000000..897128d --- /dev/null +++ b/benchmark/benchmarks.jl @@ -0,0 +1,48 @@ +#= +This file defines a benchmark suite with the tools provided by +`PkgBenchmark` and `BenchmarkTools`. + +To run the benchmarks, execute: + +```julia +julia> using PkgBenchmark +julia> results = benchmarkpkg("Expokit") +``` + +To compare current version to another tagged version, commit or branch: + +```julia +julia> results = judge("Expokit", ) +``` + +To export the benchmark results to a Markdown file: + +```julia +julia> export_markdown("results.md", results) +``` + +To export the benchmark results to a JSON file: + +```julia +julia> writeresults("results.json", results) +``` +=# +using BenchmarkTools, Expokit + +SUITE = BenchmarkGroup() # parent BenchmarkGroup to contain our suite + +include("slicot/slicot.jl") + +# From BenchmarkTools.jl +# ---------------------- +# If a cache of tuned parameters already exists, use it, otherwise, tune and cache +# the benchmark parameters. Reusing cached parameters is faster and more reliable +# than re-tuning `suite` every time the file is included. +paramspath = joinpath(dirname(@__FILE__), "params.json") + +if isfile(paramspath) + loadparams!(SUITE, BenchmarkTools.load(paramspath)[1], :evals); +else + tune!(SUITE) + BenchmarkTools.save(paramspath, params(SUITE)); +end diff --git a/benchmark/slicot/slicot.jl b/benchmark/slicot/slicot.jl new file mode 100644 index 0000000..74899e5 --- /dev/null +++ b/benchmark/slicot/slicot.jl @@ -0,0 +1,19 @@ +using JLD + +S = SUITE["SLICOT"] = BenchmarkGroup(["expmv"]) + +begin + slicot_models = load("benchmark/slicot/slicot.jld") + for si in keys(slicot_models) + A = slicot_models[si]["A"] + N = eltype(A) + n = size(A, 1) + + c = zeros(N, n) # concentrated weight + c[1] = one(N) + S[si, n, "c"] = @benchmarkable expmv(-1e-3, $A, $c) + + u = fill(one(N)/sqrt(n), n) + S[si, n, "u"] = @benchmarkable expmv(-1e-3, $A, $u) # uniform weight + end +end diff --git a/benchmark/slicot/slicot.jld b/benchmark/slicot/slicot.jld new file mode 100644 index 0000000..b061b7f Binary files /dev/null and b/benchmark/slicot/slicot.jld differ