Skip to content

Commit ebb1e7d

Browse files
committed
only benchmark constructor
1 parent 5999ac4 commit ebb1e7d

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

benchmark/benchmark_cases.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ BENCHMARK_CASES = [
2222
"diffusion_static_edge",
2323
N -> begin
2424
g = watts_strogatz(N, N ÷ 2, 0.0; rng=StableRNG(1))
25-
Network(g, diffusion_vertex(), diffusion_edge())
25+
(g, diffusion_vertex(), diffusion_edge())
2626
end,
2727
# [10,20],
2828
[100, 300, 1000, 3000],
@@ -33,7 +33,7 @@ BENCHMARK_CASES = [
3333
"diffusion_ode_edge",
3434
N -> begin
3535
g = watts_strogatz(N, N ÷ 2, 0.0; rng=StableRNG(1))
36-
Network(g, diffusion_vertex(), diffusion_dedge())
36+
(g, diffusion_vertex(), diffusion_dedge())
3737
end,
3838
# [10,20],
3939
[100, 300, 1000, 3000],
@@ -44,7 +44,7 @@ BENCHMARK_CASES = [
4444
"kuramoto_homogeneous",
4545
N -> begin
4646
g = watts_strogatz(N, 3, 0.8; rng=StableRNG(1))
47-
Network(g, kuramoto_vertex_2d(), static_kuramoto_edge())
47+
(g, kuramoto_vertex_2d(), static_kuramoto_edge())
4848
end,
4949
# [10,20],
5050
[100, 1_000, 10_000, 100_000],
@@ -58,7 +58,7 @@ BENCHMARK_CASES = [
5858
rng = StableRNG(1)
5959
vtypes = [kuramoto_vertex_1d(), kuramoto_vertex_2d()]
6060
vertices = vtypes[shuffle(rng, vcat([1 for _ in 1:N÷2], [2 for _ in 1:N÷2]))]
61-
Network(g, vertices, static_kuramoto_edge())
61+
(g, vertices, static_kuramoto_edge())
6262
end,
6363
# [10,20],
6464
[100, 1_000, 10_000, 100_000],
@@ -97,7 +97,7 @@ BENCHMARK_CASES = [
9797
# Shuffle the vertex types
9898
vertices = shuffle(rng, vcat(pq_vertices, gen_vertices))
9999

100-
Network(g, vertices, piline())
100+
(g, vertices, piline())
101101
end,
102102
[100, 1_000, 10_000, 100_000],
103103
"Power grid with heterogeneous PQ nodes having fixed P/Q values"

benchmark/benchmarks.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,16 @@ for case in BENCHMARK_CASES
7373
enabled=!haskey(ENV,"GITHUB_ACTIONS"))
7474

7575
for N in case.Ns
76-
# Create network
77-
_nd = case.constructor(N)
76+
# Create network components
77+
(g, vertices, edges) = case.constructor(N)
7878

7979
# Benchmark network construction
80-
b = @be $(case.constructor)($N) evals=1 samples=10 seconds=SECONDS
80+
b = @be Network($g, $vertices, $edges) evals=1 samples=10 seconds=SECONDS
8181
bd[case.name, "assemble", N] = BenchmarkResult(b)
8282

83+
# Create network instance
84+
_nd = Network(g, vertices, edges)
85+
8386
# Setup initial conditions
8487
_x0 = randx0(_nd)
8588
_dx = similar(_x0)

0 commit comments

Comments
 (0)