Skip to content

Commit

Permalink
Refactor code to use sum function in make.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing committed Dec 24, 2023
1 parent 72db773 commit 5da6cd6
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions benchmark/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@ suite["greedy"] = BenchmarkGroup([])
suite["kahypar"] = BenchmarkGroup([])

# BENCHMARK 1
expr = EinExpr(
Symbol[],
[
EinExpr([:j, :b, :i, :h], Dict(i => 2 for i in [:j, :b, :i, :h])),
EinExpr([:a, :c, :e, :f], Dict(i => 2 for i in [:a, :c, :e, :f])),
EinExpr([:j], Dict(i => 2 for i in [:j])),
EinExpr([:e, :a, :g], Dict(i => 2 for i in [:e, :a, :g])),
EinExpr([:f, :b], Dict(i => 2 for i in [:f, :b])),
EinExpr([:i, :h, :d], Dict(i => 2 for i in [:i, :h, :d])),
EinExpr([:d, :g, :c], Dict(i => 2 for i in [:d, :g, :c])),
],
)
expr = sum([
EinExpr([:j, :b, :i, :h], Dict(i => 2 for i in [:j, :b, :i, :h])),
EinExpr([:a, :c, :e, :f], Dict(i => 2 for i in [:a, :c, :e, :f])),
EinExpr([:j], Dict(i => 2 for i in [:j])),
EinExpr([:e, :a, :g], Dict(i => 2 for i in [:e, :a, :g])),
EinExpr([:f, :b], Dict(i => 2 for i in [:f, :b])),
EinExpr([:i, :h, :d], Dict(i => 2 for i in [:i, :h, :d])),
EinExpr([:d, :g, :c], Dict(i => 2 for i in [:d, :g, :c])),
])

suite["naive"][1] = @benchmarkable einexpr(EinExprs.Naive(), $expr)
suite["exhaustive"][1] = @benchmarkable einexpr(Exhaustive(), $expr)
Expand All @@ -41,7 +38,7 @@ D = EinExpr([:c, :h, :d, :i], Dict(:c => 2, :h => 2, :d => 2, :i => 2))
E = EinExpr([:f, :i, :g, :j], Dict(:f => 2, :i => 2, :g => 2, :j => 2))
F = EinExpr([:B, :h, :k, :l], Dict(:B => 2, :h => 2, :k => 2, :l => 2))
G = EinExpr([:j, :k, :l, :D], Dict(:j => 2, :k => 2, :l => 2, :D => 2))
expr = EinExpr([:A, :B, :C, :D], [A, B, C, D, E, F, G])
expr = sum([A, B, C, D, E, F, G], skip = [:A, :B, :C, :D])

suite["naive"][2] = @benchmarkable einexpr(EinExprs.Naive(), $expr)
suite["exhaustive"][2] = @benchmarkable einexpr(Exhaustive(), $expr)
Expand Down

0 comments on commit 5da6cd6

Please sign in to comment.