|
6 | 6 | - results = benchmarkpkg("IntervalArithmetic")
|
7 | 7 | - showall(results)
|
8 | 8 |
|
9 |
| -- results = judge("IntervalArithmetic", "v0.9.1") # compare current version to that tag |
| 9 | +To compare the current version with a given release use `judge`: |
| 10 | +
|
| 11 | +- results = judge("IntervalArithmetic", tag) |
10 | 12 | - showall(results)
|
11 |
| -=# |
12 | 13 |
|
| 14 | +To export the benchmark results to a markdown file, do: |
13 | 15 |
|
14 |
| -using IntervalArithmetic |
| 16 | +- export_markdown("results.md", results) |
| 17 | +=# |
15 | 18 |
|
16 |
| -@benchgroup "Constructors" begin |
17 |
| - @bench "Interval" Interval(1, 2) |
18 |
| -end |
| 19 | +using BenchmarkTools, IntervalArithmetic |
19 | 20 |
|
20 |
| -@benchgroup "@interval" begin |
| 21 | +const SUITE = BenchmarkGroup() # parent BenchmarkGroup to contain our suite |
21 | 22 |
|
22 |
| - @bench "@interval" @interval(0.1) |
23 |
| - @bench "pi" @interval(pi) |
24 |
| - @bench "expression" @interval(sin(0.1) + cos(0.2)) |
25 |
| -end |
| 23 | +S = SUITE["Constructors"] = BenchmarkGroup() |
| 24 | +S["Interval"] = @benchmarkable Interval(1, 2) |
26 | 25 |
|
27 |
| -@benchgroup "Arithmetic" begin |
| 26 | +S = SUITE["Intervals"] = BenchmarkGroup() |
| 27 | +S["@interval"] = @benchmarkable @interval(0.1) |
| 28 | +S["pi"] = @benchmarkable @interval(pi) |
| 29 | +S["expression"] = @benchmarkable @interval(sin(0.1) + cos(0.2)) |
28 | 30 |
|
| 31 | +S = SUITE["Arithmetic"] = BenchmarkGroup() |
| 32 | +begin |
29 | 33 | a = Interval(1, 2)
|
30 | 34 | b = Interval(3, 4)
|
31 | 35 |
|
32 | 36 | for op in (+, -, *, /)
|
33 |
| - @bench string(op) $(op)($a, $b) |
| 37 | + S[string(op)] = @benchmarkable $(op)($a, $b) |
34 | 38 | end
|
35 | 39 | end
|
36 | 40 |
|
37 |
| -@benchgroup "Elementary functions" begin |
| 41 | +S = SUITE["Elementary functions"] = BenchmarkGroup() |
| 42 | +begin |
38 | 43 | for op in (exp, log, sin, tan)
|
39 |
| - @bench string(op) $(op)($a) |
| 44 | + S[string(op)] = @benchmarkable $(op)($a) |
40 | 45 | end
|
41 | 46 | end
|
42 | 47 |
|
43 |
| -@benchgroup "Sum" begin |
44 |
| - |
| 48 | +S = SUITE["Sum"] = BenchmarkGroup() |
| 49 | +begin |
45 | 50 | sum1(N) = sum(Interval(i, i+1) for i in 1:N)
|
46 |
| - sum2(N) = (one = Interval(1.0); sum(one / (i^2) for i in 1:N) ) |
47 |
| - |
48 |
| - @bench "Sum1" sum1(1000) |
49 |
| - @bench "Sum2" sum2(1000) |
| 51 | + sum2(N) = (one = Interval(1.0); sum(one / (i^2) for i in 1:N)) |
| 52 | + S["Sum1"] = @benchmarkable sum1(1000) |
| 53 | + S["Sum2"] = @benchmarkable sum2(1000) |
50 | 54 | end
|
0 commit comments