Skip to content

Commit

Permalink
Add Specializations branch to benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeingold committed Nov 12, 2024
1 parent 838e65e commit c3a36d2
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ rules = (
(name = "HAdaptiveCubature", rule = HAdaptiveCubature(), N = 500)
)
geometries = (
(name = "Meshes.BezierCurve",
item = BezierCurve([Point(t, sin(t), 0.0) for t in range(-π, π, length = 361)])),
(name = "Meshes.Segment", item = Segment(Point(0, 0, 0), Point(1, 1, 1))),
(name = "Meshes.Sphere", item = Sphere(Point(0, 0, 0), 1.0))
)
Expand All @@ -33,6 +31,33 @@ SUITE["Integrals"] = let s = BenchmarkGroup()
s
end

############################################################################################
# Specializations
############################################################################################

spec = (
f = p -> norm(to(p)),
g = (
bezier = BezierCurve([Point(t, sin(t), 0) for t in range(-pi, pi, length = 361)]),
triangle = Triangle(Point(1,0,0), Point(0,1,0), Point(0,0,1)),
tetrahedron = let
a = Point(0, 3, 0)
b = Point(-7, 0, 0)
c = Point(8, 0, 0)
= Vec(0, 0, 1)
Tetrahedron(a, b, c, a + ẑ)
end
),
rule = HAdaptiveCubature()
)

SUITE["Specializations"] = let s = BenchmarkGroup()
s["BezierCurve"] = @benchmarkable integral($spec.f, $spec.g.bezier, $spec.rule)
s["Triangle"] = @benchmarkable integral($spec.f, $spec.g.triangle, $spec.rule)
s["Tetrahedron"] = @benchmarkable integral($spec.f, $spec.g.tetrahedron, $spec.rule)
s
end

############################################################################################
# Differentials
############################################################################################
Expand Down

0 comments on commit c3a36d2

Please sign in to comment.