comparison benchmark/benchmark_utils.jl @ 1197:5e20c0815e07 tooling/benchmarks

Pass kwargs from main() and run_benchmarks() to benchmarkpkg()
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 31 Jan 2023 20:35:29 +0100
parents 339cb6eacb0c
children 68dd0c9f5cac
comparison
equal deleted inserted replaced
1196:2f208828ae58 1197:5e20c0815e07
25 """ 25 """
26 run_benchmark() 26 run_benchmark()
27 27
28 Runs the benchmark suite for the current working directory and returns a `PkgBenchmark.BenchmarkResult` 28 Runs the benchmark suite for the current working directory and returns a `PkgBenchmark.BenchmarkResult`
29 """ 29 """
30 function run_benchmark() 30 function run_benchmark(;kwargs...)
31 r = PkgBenchmark.benchmarkpkg(Sbplib) 31 r = PkgBenchmark.benchmarkpkg(Sbplib; kwargs...)
32 32
33 rev = hg_id() 33 rev = hg_id()
34 34
35 return add_rev_info(r, rev) 35 return add_rev_info(r, rev)
36 end 36 end
41 Updates the repository to the given revison and runs the benchmark suite. When done, updates the repository to the origianl state. 41 Updates the repository to the given revison and runs the benchmark suite. When done, updates the repository to the origianl state.
42 `rev` can be any identifier compatible with `hg update`. 42 `rev` can be any identifier compatible with `hg update`.
43 43
44 Returns a `PkgBenchmark.BenchmarkResult` 44 Returns a `PkgBenchmark.BenchmarkResult`
45 """ 45 """
46 function run_benchmark(rev) 46 function run_benchmark(rev; kwargs...)
47 rev_before = hg_rev() 47 rev_before = hg_rev()
48 hg_update(rev) 48 hg_update(rev)
49 r = run_benchmark() 49 r = run_benchmark(;kwargs...)
50 hg_update(rev_before) 50 hg_update(rev_before)
51 51
52 return r 52 return r
53 end 53 end
54 54
60 60
61 `target` and `baseline` can be any identifier compatible with `hg update`. 61 `target` and `baseline` can be any identifier compatible with `hg update`.
62 62
63 Returns a `PkgBenchmark.BenchmarkJudgement` 63 Returns a `PkgBenchmark.BenchmarkJudgement`
64 """ 64 """
65 function run_benchmark(target, baseline, f=minimum; judgekwargs=Dict()) 65 function run_benchmark(target, baseline, f=minimum; judgekwargs=Dict(), kwargs...)
66 rev_before = hg_rev() 66 rev_before = hg_rev()
67 hg_update(target) 67 hg_update(target)
68 t = run_benchmark() 68 t = run_benchmark(;kwargs...)
69 hg_update(baseline) 69 hg_update(baseline)
70 b = run_benchmark() 70 b = run_benchmark(;kwargs...)
71 hg_update(rev_before) 71 hg_update(rev_before)
72 72
73 return PkgBenchmark.judge(t,b,f; judgekwargs...) 73 return PkgBenchmark.judge(t,b,f; judgekwargs...)
74 end 74 end
75 75