-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minimal benchmark setup #736
Conversation
c511e52
to
26da068
Compare
26da068
to
111ad5c
Compare
@@ -0,0 +1,12 @@ | |||
# Each file of the form "bench_$(name).jl" in this directory is `include`d and | |||
# its last statement is assumed to be a `BenchmarkGroup`. This group is added | |||
# to the top-level group `SUITE` with the `$name` extracted from the file name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about this strategy? I use this for all my packages and it works well for me. This is useful for running each file separately like this: run(include("benchmark/bench_qr.jl"))
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds completely fine to me!
PS: My fantasy interface might be more akin to @testset
where the groups are assembled "magically" using dynamic scope
@benchmark_group "all" begin
@benchmark_group "QR $K" for K=1:22
a = rand(SMatrix{K,K,Float64,K*K})
m = Matrix(a)
@benchmarkable qr($a)
@benchmarkable qr($m)
end
# other groups or includes()...
end
but unlike Test
, to allow running these selectively. But no doubt that's an issue for BenchmarkTools ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PS: My fantasy interface might be more akin to @testset where the groups are assembled "magically" using dynamic scope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the crossref 👍
I do strongly disagree with Jarret on that one. I think dynamic scoping (not global scope mind you!) can be fairly clear and non-magical for this kind of use as long as it's clearly documented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good; simple enough and flexible.
@@ -0,0 +1,12 @@ | |||
# Each file of the form "bench_$(name).jl" in this directory is `include`d and | |||
# its last statement is assumed to be a `BenchmarkGroup`. This group is added | |||
# to the top-level group `SUITE` with the `$name` extracted from the file name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds completely fine to me!
PS: My fantasy interface might be more akin to @testset
where the groups are assembled "magically" using dynamic scope
@benchmark_group "all" begin
@benchmark_group "QR $K" for K=1:22
a = rand(SMatrix{K,K,Float64,K*K})
m = Matrix(a)
@benchmarkable qr($a)
@benchmarkable qr($m)
end
# other groups or includes()...
end
but unlike Test
, to allow running these selectively. But no doubt that's an issue for BenchmarkTools ;-)
# to the top-level group `SUITE` with the `$name` extracted from the file name. | ||
|
||
using BenchmarkTools | ||
SUITE = BenchmarkGroup() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be const
I guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, initially I didn't want const
to avoid seeing the redefinition warning but it's not a good motivation anymore since I use modules.
using LinearAlgebra | ||
using StaticArrays | ||
|
||
suite = BenchmarkGroup() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be const
I guess?
See #737. Please comment on how we organize
benchmark/*
here.