Skip to content

Latest commit

 

History

History
65 lines (51 loc) · 1.63 KB

File metadata and controls

65 lines (51 loc) · 1.63 KB
CurrentModule = MathOptInterface
DocTestSetup = quote
    import MathOptInterface as MOI
end
DocTestFilters = [r"MathOptInterface|MOI"]

The Benchmarks submodule

To aid the development of efficient solver wrappers, MathOptInterface provides a suite of benchmarks in the MOI.Benchmarks submodule.

!!! warning To use this submodule you must first install and load BenchmarkTools.jl. julia import Pkg Pkg.add("BenchmarkTools") import BenchmarkTools

Benchmarking a solver wrapper

Benchmarking a wrapper follows a two-step process.

First, prior to making changes, create a baseline for the benchmark results on a given benchmark suite as follows:

# You must load BenchmarkTools.jl to enable MOI.Benchmarks
import BenchmarkTools
# Replace `SolverPackage` with your choice of solver
using SolverPackage
import MathOptInterface as MOI

suite = MOI.Benchmarks.suite() do
    SolverPackage.Optimizer()
end

MOI.Benchmarks.create_baseline(
    suite, "current"; directory = "/tmp", verbose = true
)

Use the exclude argument to Benchmarks.suite to exclude benchmarks that the solver doesn't support.

Second, after making changes to the package, re-run the benchmark suite and compare to the prior saved results:

import BenchmarkTools
using SolverPackage
import MathOptInterface as MOI

suite = MOI.Benchmarks.suite() do
    SolverPackage.Optimizer()
end

MOI.Benchmarks.compare_against_baseline(
    suite, "current"; directory = "/tmp", verbose = true
)

This comparison will create a report detailing improvements and regressions.