Skip to content

Commit 9b8935d

Browse files
authored
Add iai versions of the runtime benchmarks (#3016)
* Include graph runtime benchmarks in ci regression run * Update benchmarking workflow * Remove ci script changes
1 parent e003389 commit 9b8935d

File tree

5 files changed

+85
-0
lines changed

5 files changed

+85
-0
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node-graph/interpreted-executor/Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ serde = { workspace = true }
2828
# Workspace dependencies
2929
graph-craft = { workspace = true, features = ["loading"] }
3030
criterion = { workspace = true }
31+
iai-callgrind = { workspace = true }
3132

3233
# Benchmarks
3334
[[bench]]
@@ -42,3 +43,15 @@ harness = false
4243
name = "run_cached"
4344
harness = false
4445

46+
[[bench]]
47+
name = "update_executor_iai"
48+
harness = false
49+
50+
[[bench]]
51+
name = "run_once_iai"
52+
harness = false
53+
54+
[[bench]]
55+
name = "run_cached_iai"
56+
harness = false
57+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
use graph_craft::util::*;
2+
use graphene_std::Context;
3+
use iai_callgrind::{black_box, library_benchmark, library_benchmark_group, main};
4+
use interpreted_executor::dynamic_executor::DynamicExecutor;
5+
6+
fn setup_run_cached(name: &str) -> DynamicExecutor {
7+
let network = load_from_name(name);
8+
let proto_network = compile(network);
9+
let executor = futures::executor::block_on(DynamicExecutor::new(proto_network)).unwrap();
10+
11+
// Warm up the cache by running once
12+
let context: Context = None;
13+
let _ = futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), context.clone()));
14+
15+
executor
16+
}
17+
18+
#[library_benchmark]
19+
#[benches::with_setup(args = ["isometric-fountain", "painted-dreams", "procedural-string-lights", "parametric-dunescape", "red-dress", "valley-of-spires"], setup = setup_run_cached)]
20+
pub fn run_cached(executor: DynamicExecutor) {
21+
let context: Context = None;
22+
black_box(futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), black_box(context))).unwrap());
23+
}
24+
25+
library_benchmark_group!(name = run_cached_group; benchmarks = run_cached);
26+
27+
main!(library_benchmark_groups = run_cached_group);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
use graph_craft::util::*;
2+
use graphene_std::Context;
3+
use iai_callgrind::{black_box, library_benchmark, library_benchmark_group, main};
4+
use interpreted_executor::dynamic_executor::DynamicExecutor;
5+
6+
fn setup_run_once(name: &str) -> DynamicExecutor {
7+
let network = load_from_name(name);
8+
let proto_network = compile(network);
9+
futures::executor::block_on(DynamicExecutor::new(proto_network)).unwrap()
10+
}
11+
12+
#[library_benchmark]
13+
#[benches::with_setup(args = ["isometric-fountain", "painted-dreams", "procedural-string-lights", "parametric-dunescape", "red-dress", "valley-of-spires"], setup = setup_run_once)]
14+
pub fn run_once(executor: DynamicExecutor) {
15+
let context: Context = None;
16+
black_box(futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), black_box(context))).unwrap());
17+
}
18+
19+
library_benchmark_group!(name = run_once_group; benchmarks = run_once);
20+
21+
main!(library_benchmark_groups = run_once_group);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use graph_craft::proto::ProtoNetwork;
2+
use graph_craft::util::*;
3+
use iai_callgrind::{black_box, library_benchmark, library_benchmark_group, main};
4+
use interpreted_executor::dynamic_executor::DynamicExecutor;
5+
6+
fn setup_update_executor(name: &str) -> (DynamicExecutor, ProtoNetwork) {
7+
let network = load_from_name(name);
8+
let proto_network = compile(network);
9+
let empty = ProtoNetwork::default();
10+
let executor = futures::executor::block_on(DynamicExecutor::new(empty)).unwrap();
11+
(executor, proto_network)
12+
}
13+
14+
#[library_benchmark]
15+
#[benches::with_setup(args = ["isometric-fountain", "painted-dreams", "procedural-string-lights", "parametric-dunescape", "red-dress", "valley-of-spires"], setup = setup_update_executor)]
16+
pub fn update_executor(setup: (DynamicExecutor, ProtoNetwork)) {
17+
let (mut executor, network) = setup;
18+
let _ = black_box(futures::executor::block_on(executor.update(black_box(network))));
19+
}
20+
21+
library_benchmark_group!(name = update_group; benchmarks = update_executor);
22+
23+
main!(library_benchmark_groups = update_group);

0 commit comments

Comments
 (0)