Chairmarks.jl
Chairmarks.jl copied to clipboard
How to setup for function with multiple arguments?
I am writing a PR to Modern Julia Workflows to suggest Chairmarks over BenchmarkTools. Their current text has this BenchmarkTools.jl example that I don't know how to do with Chairmarks. I couldn't find any examples like this in the documentation.
my_matmul(A, b) = A * b;
@btime my_matmul(A, b) setup=(
A = rand(1000, 1000); # use semi-colons between setup lines
b = rand(1000)
);
Thanks for asking!
@b rand(1000, 1000),rand(1000) my_matmul(_...)
The setup block can only return a single value, but that value may be a tuple.
I'll leave this issue open until I add an example to the docs which showcases this.
I guess a NamedTuple could also be useful for clarity.
@be (A=rand(1000,1000), b=rand(1000)) my_matmul(_.A, _.b)
Here's the MJW PR in case you're interested: https://github.com/modernjuliaworkflows/modernjuliaworkflows.github.io/pull/138