Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "HerbInterpret"
uuid = "5bbddadd-02c5-4713-84b8-97364418cca7"
version = "1.0.1"
version = "1.1.0"
authors = ["Tilman Hinnerichs <t.r.hinnerichs@tudelft.nl>", "Jaap de Jong <jaapdejong15@gmail.com>", "Sebastijan Dumancic <s.dumancic@tudelft.nl>", "Reuben Gardos Reid <R.J.GardosReid@tudelft.nl>"]

[deps]
Expand All @@ -15,3 +15,6 @@ HerbGrammar = "1"
HerbSpecification = "1"
RuntimeGeneratedFunctions = "0.5.16"
julia = "1.10"

[workspace]
projects = ["test", "benchmark"]
18 changes: 18 additions & 0 deletions benchmark/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
name = "Benchmarks"
uuid = "6ee5f8fb-11dd-42bf-93c4-422a4e5be4dc"

[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
HerbBenchmarks = "eadf8b74-d38a-4b1a-a063-8d36e493d376"
HerbConstraints = "1fa96474-3206-4513-b4fa-23913f296dfc"
HerbCore = "2b23ba43-8213-43cb-b5ea-38c12b45bd45"
HerbGrammar = "4ef9e186-2fe5-4b24-8de7-9f7291f24af7"
HerbInterpret = "5bbddadd-02c5-4713-84b8-97364418cca7"
HerbSearch = "3008d8e8-f9aa-438a-92ed-26e9c7b4829f"
Profile = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"
ProfileView = "c46f51b8-102a-5cf2-8d2c-8597cb0e0da7"
RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47"

[sources]
HerbBenchmarks = {rev = "10f07530c03bd5510f636aa5aa06b66e69ad994b", url = "https://github.com/Herb-AI/HerbBenchmarks.jl"}

[compat]
HerbBenchmarks = "0.2.3"
Profile = "1.11.0"
ProfileView = "1.10.3"
16 changes: 12 additions & 4 deletions benchmark/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
# `HerbInterpret` Benchmarks

This directory contains a small benchmark suite for `HerbInterpret` to protect against performance regressions.
This directory contains a small benchmark suite for `HerbInterpret` to protect
against performance regressions.

The suite is constructed in `benchmarks.jl` using [`BenchmarkTools.jl`](https://juliaci.github.io/BenchmarkTools.jl/stable/).
The suite is constructed in `benchmarks.jl` using
[`BenchmarkTools.jl`](https://juliaci.github.io/BenchmarkTools.jl/stable/).

The suite is assigned to a constant, `SUITE`. Running `benchmarks.jl` does *not* run the benchmark, that is the job of tools like [`AirspeedVelocity`](https://juliahub.com/ui/Packages/General/AirspeedVelocity) and [`PkgBenchmark`](https://juliahub.com/ui/Packages/General/PkgBenchmark). These are tools you might want to install in your global Julia environment. With `AirspeedVelocity`, you can run the benchmarks like this:
The suite is assigned to a constant, `SUITE`. Running `benchmarks.jl` does
*not* run the benchmark, that is the job of tools like
[`AirspeedVelocity`](https://juliahub.com/ui/Packages/General/AirspeedVelocity)
and [`PkgBenchmark`](https://juliahub.com/ui/Packages/General/PkgBenchmark).
These are tools you might want to install in your global Julia environment.
With `AirspeedVelocity`, you can run the benchmarks like this:

```sh
benchpkg HerbInterpret --rev=v0.1.7,dirty --path=.
```

where the path points to the base directory of `HerbInterpret.jl` (meaning it should be `--path=..` if you're in the `benchmark` directory).
where the path points to the base directory of `HerbInterpret.jl` (meaning it
should be `--path=..` if you're in the `benchmark` directory).
40 changes: 1 addition & 39 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
@@ -1,39 +1 @@
using BenchmarkTools
using Random: seed!
using HerbGrammar: @csgrammar, grammar2symboltable, rulenode2expr
using HerbCore: RuleNode
# currently this is defined in Search, but should ideally have a definition in Core
# because having to add Search here in the benchmark environment creates annoying
# circular dependencies. For now, store the expressions tested in `exprs.jl`
# using HerbSearch: rand
using HerbInterpret: interpret

include("exprs.jl")

function create_interpret_benchmark()
suite = BenchmarkGroup()
seed!(42) # keep random expressions constant
g = @csgrammar begin
Var = Var + Var
Var = Var * Var
Var = Var / Var
Var = |(0:5)
end

# once we move random RuleNode sampling to Core
# exprs = [rulenode2expr(rand(RuleNode, g), g) for _ in 1:1000]

st = grammar2symboltable(g)

suite["Random Expressions"] = @benchmarkable interpret.(($st,), $EXPRS)

return suite
end

function create_benchmarks()
suite = BenchmarkGroup()
suite["interpret"] = create_interpret_benchmark()
return suite
end

const SUITE = create_benchmarks()
const SUITE = Benchmark.create_benchmarks()
Loading
Loading