From 60917e0b83f0f18746e104012f291b0b1f9c1d98 Mon Sep 17 00:00:00 2001 From: Wouter Nuijten Date: Tue, 7 Jan 2025 12:58:40 +0100 Subject: [PATCH] Update benchmark infrastructure to allow judge --- Makefile | 2 +- benchmark/benchmarks.jl | 1 + scripts/benchmark.jl | 15 ++++++++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 3af24b90..a72fcd6f 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ format: scripts_init ## Code formating run julia --startup-file=no --project=scripts/ scripts/format.jl --overwrite benchmark: scripts_init ## Code formating run - julia --startup-file=no --project=scripts/ scripts/benchmark.jl + julia --startup-file=no --project=scripts/ scripts/benchmark.jl $(branch) .PHONY: docs diff --git a/benchmark/benchmarks.jl b/benchmark/benchmarks.jl index 6be45428..674e0375 100644 --- a/benchmark/benchmarks.jl +++ b/benchmark/benchmarks.jl @@ -1,5 +1,6 @@ using BenchmarkTools using ExponentialFamily, Distributions, Random +using ExponentialFamily.BayesBase const SUITE = BenchmarkGroup() diff --git a/scripts/benchmark.jl b/scripts/benchmark.jl index 0fd79ee1..4ef9c9f9 100644 --- a/scripts/benchmark.jl +++ b/scripts/benchmark.jl @@ -1,10 +1,15 @@ -using PkgBenchmark, Dates +using PkgBenchmark, BenchmarkTools, Dates import ExponentialFamily -results = benchmarkpkg(ExponentialFamily) - mkpath("./benchmark_logs") -export_markdown("./benchmark_logs/benchmark_$(now()).md", results) -export_markdown("./benchmark_logs/last.md", results) +if isempty(ARGS) + result = PkgBenchmark.benchmarkpkg(ExponentialFamily) + export_markdown("./benchmark_logs/benchmark_$(now()).md", result) + export_markdown("./benchmark_logs/last.md", result) +else + name = first(ARGS) + BenchmarkTools.judge(ExponentialFamily, name; judgekwargs = Dict(:time_tolerance => 0.1, :memory_tolerance => 0.05)) + export_markdown("benchmark_vs_$(name)_result.md", result) +end