-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a template and plugin for PkgBenchmarks (#261)
* add a template and plugin for BenchmarkTools * Rename into PkgBenchmark * Fix tests * Docstring --------- Co-authored-by: = <=> Co-authored-by: Guillaume Dalle <[email protected]>
- Loading branch information
1 parent
e7b5a51
commit dea191b
Showing
7 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,7 @@ Citation | |
RegisterAction | ||
Formatter | ||
CodeOwners | ||
PkgBenchmark | ||
``` | ||
|
||
## A More Complicated Example | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ export | |
License, | ||
Logo, | ||
NoDeploy, | ||
PkgBenchmark, | ||
PkgEvalBadge, | ||
ProjectFile, | ||
Readme, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
PkgBenchmark(; file="$(contractuser(default_file("benchmark", "benchmarks.jl")))") | ||
Sets up a [PkgBenchmark.jl](https://github.com/JuliaCI/PkgBenchmark.jl) benchmark suite. | ||
To ensure benchmark reproducibility, you will need to manually create an environment in the `benchmark` subfolder (for which the `Manifest.toml` is committed to version control). | ||
In this environment, you should at the very least: | ||
- `pkg> add BenchmarkTools` | ||
- `pkg> dev` your new package. | ||
## Keyword Arguments | ||
- `file::AbstractString`: Template file for `benchmarks.jl`. | ||
""" | ||
@plugin struct PkgBenchmark <: FilePlugin | ||
file::String = default_file("benchmark", "benchmarks.jl") | ||
end | ||
|
||
source(p::PkgBenchmark) = p.file | ||
destination(::PkgBenchmark) = joinpath("benchmark", "benchmarks.jl") | ||
view(::PkgBenchmark, ::Template, pkg::AbstractString) = Dict("PKG" => pkg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using {{{PKG}}} | ||
using BenchmarkTools | ||
|
||
SUITE = BenchmarkGroup() | ||
SUITE["rand"] = @benchmarkable rand(10) | ||
|
||
# Write your benchmarks here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using WackyOptions | ||
using BenchmarkTools | ||
|
||
SUITE = BenchmarkGroup() | ||
SUITE["rand"] = @benchmarkable rand(10) | ||
|
||
# Write your benchmarks here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters