Skip to content

Commit d317933

Browse files
authored
Minimal benchmark setup (#736)
1 parent 7a78efd commit d317933

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
*.jl.*.cov
33
*.jl.mem
44
/Manifest.toml
5+
/benchmark/Manifest.toml
56
/docs/Manifest.toml

benchmark/Project.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[deps]
2+
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
3+
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
4+
PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d"

benchmark/bench_qr.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module BenchQR
2+
3+
using BenchmarkTools
4+
using LinearAlgebra
5+
using StaticArrays
6+
7+
suite = BenchmarkGroup()
8+
9+
for K = 1:22
10+
a = rand(SMatrix{K,K,Float64,K*K})
11+
m = Matrix(a)
12+
s = suite["S=$K"] = BenchmarkGroup()
13+
s["SMatrix"] = @benchmarkable qr($a)
14+
s["Matrix"] = @benchmarkable qr($m)
15+
end
16+
17+
end # module
18+
BenchQR.suite

benchmark/benchmarks.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Each file of the form "bench_$(name).jl" in this directory is `include`d and
2+
# its last statement is assumed to be a `BenchmarkGroup`. This group is added
3+
# to the top-level group `SUITE` with the `$name` extracted from the file name.
4+
5+
using BenchmarkTools
6+
SUITE = BenchmarkGroup()
7+
for file in sort(readdir(@__DIR__))
8+
if startswith(file, "bench_") && endswith(file, ".jl")
9+
SUITE[chop(file, head = length("bench_"), tail = length(".jl"))] =
10+
include(file)
11+
end
12+
end

0 commit comments

Comments
 (0)