-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from biaslab/bench
Add simple benchmark suite
- Loading branch information
Showing
6 changed files
with
78 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
/docs/Manifest.toml | ||
|
||
.DS_Store | ||
benchmark*.md |
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,26 @@ | ||
using BenchmarkTools | ||
|
||
const SUITE = BenchmarkGroup() | ||
|
||
include("mockenv.jl") | ||
|
||
function discrete_benchmarks() | ||
SUITE = BenchmarkGroup(["Discrete Environment"]) | ||
env = RxEnvironment(MockEnvironment; is_discrete=true) | ||
agent = add!(env, MockEntity()) | ||
SUITE["send to agent"] = @benchmarkable send!($agent, $env, 10.0) | ||
SUITE["send to environment"] = @benchmarkable send!($env, $agent, 10.0) | ||
return SUITE | ||
end | ||
|
||
function continuous_benchmarks() | ||
SUITE = BenchmarkGroup(["Continuous Environment"]) | ||
env = RxEnvironment(MockEnvironment; is_discrete=false) | ||
agent = add!(env, MockEntity()) | ||
SUITE["send to agent"] = @benchmarkable send!($agent, $env, 10.0) | ||
SUITE["send to environment"] = @benchmarkable send!($env, $agent, 10.0) | ||
return SUITE | ||
end | ||
|
||
SUITE["Discrete Environment"] = discrete_benchmarks() | ||
SUITE["Continuous Environment"] = continuous_benchmarks() |
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,30 @@ | ||
using RxEnvironments | ||
|
||
struct MockEntity end | ||
|
||
struct MockEnvironment end | ||
|
||
RxEnvironments.update!(subject::MockEnvironment, elapsed_time) = nothing | ||
RxEnvironments.what_to_send( | ||
recipient::MockEntity, | ||
emitter::MockEnvironment, | ||
observation::Float64, | ||
) = 1.0 | ||
|
||
RxEnvironments.what_to_send( | ||
recipient::MockEnvironment, | ||
emitter::MockEntity, | ||
observation::Float64, | ||
) = 1.0 | ||
|
||
RxEnvironments.emits( | ||
subject::MockEntity, | ||
listener::MockEnvironment, | ||
action::Float64, | ||
) = false | ||
|
||
RxEnvironments.emits( | ||
subject::MockEnvironment, | ||
listener::MockEntity, | ||
action::Float64, | ||
) = true |
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 @@ | ||
[{"Julia":"1.10.2","BenchmarkTools":"1.5.0"},[["BenchmarkGroup",{"data":{"Discrete Environment":["BenchmarkGroup",{"data":{"send to environment":["Parameters",{"gctrial":true,"time_tolerance":0.05,"evals_set":false,"samples":10000,"evals":1,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"send to agent":["Parameters",{"gctrial":true,"time_tolerance":0.05,"evals_set":false,"samples":10000,"evals":5,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":["Discrete Environment"]}],"Continuous Environment":["BenchmarkGroup",{"data":{"send to environment":["Parameters",{"gctrial":true,"time_tolerance":0.05,"evals_set":false,"samples":10000,"evals":9,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"send to agent":["Parameters",{"gctrial":true,"time_tolerance":0.05,"evals_set":false,"samples":10000,"evals":152,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":["Continuous Environment"]}]},"tags":[]}]]] |
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,16 @@ | ||
using RxEnvironments | ||
using BenchmarkTools | ||
using PkgBenchmark | ||
|
||
result, name = if ARGS == [] | ||
PkgBenchmark.benchmarkpkg(RxEnvironments), "current" | ||
else | ||
BenchmarkTools.judge( | ||
RxEnvironments, | ||
ARGS[1]; | ||
judgekwargs = Dict(:time_tolerance => 0.1, :memory_tolerance => 0.05), | ||
), | ||
ARGS[1] | ||
end | ||
|
||
export_markdown("benchmark_vs_$(name)_result.md", result) |