Add iai versions of the runtime benchmarks (#3016)
* Include graph runtime benchmarks in ci regression run * Update benchmarking workflow * Remove ci script changes
This commit is contained in:
parent
e003389526
commit
9b8935d201
|
|
@ -2693,6 +2693,7 @@ dependencies = [
|
||||||
"graphene-core",
|
"graphene-core",
|
||||||
"graphene-path-bool",
|
"graphene-path-bool",
|
||||||
"graphene-std",
|
"graphene-std",
|
||||||
|
"iai-callgrind",
|
||||||
"log",
|
"log",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ serde = { workspace = true }
|
||||||
# Workspace dependencies
|
# Workspace dependencies
|
||||||
graph-craft = { workspace = true, features = ["loading"] }
|
graph-craft = { workspace = true, features = ["loading"] }
|
||||||
criterion = { workspace = true }
|
criterion = { workspace = true }
|
||||||
|
iai-callgrind = { workspace = true }
|
||||||
|
|
||||||
# Benchmarks
|
# Benchmarks
|
||||||
[[bench]]
|
[[bench]]
|
||||||
|
|
@ -42,3 +43,15 @@ harness = false
|
||||||
name = "run_cached"
|
name = "run_cached"
|
||||||
harness = false
|
harness = false
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "update_executor_iai"
|
||||||
|
harness = false
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "run_once_iai"
|
||||||
|
harness = false
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "run_cached_iai"
|
||||||
|
harness = false
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
use graph_craft::util::*;
|
||||||
|
use graphene_std::Context;
|
||||||
|
use iai_callgrind::{black_box, library_benchmark, library_benchmark_group, main};
|
||||||
|
use interpreted_executor::dynamic_executor::DynamicExecutor;
|
||||||
|
|
||||||
|
fn setup_run_cached(name: &str) -> DynamicExecutor {
|
||||||
|
let network = load_from_name(name);
|
||||||
|
let proto_network = compile(network);
|
||||||
|
let executor = futures::executor::block_on(DynamicExecutor::new(proto_network)).unwrap();
|
||||||
|
|
||||||
|
// Warm up the cache by running once
|
||||||
|
let context: Context = None;
|
||||||
|
let _ = futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), context.clone()));
|
||||||
|
|
||||||
|
executor
|
||||||
|
}
|
||||||
|
|
||||||
|
#[library_benchmark]
|
||||||
|
#[benches::with_setup(args = ["isometric-fountain", "painted-dreams", "procedural-string-lights", "parametric-dunescape", "red-dress", "valley-of-spires"], setup = setup_run_cached)]
|
||||||
|
pub fn run_cached(executor: DynamicExecutor) {
|
||||||
|
let context: Context = None;
|
||||||
|
black_box(futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), black_box(context))).unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
|
library_benchmark_group!(name = run_cached_group; benchmarks = run_cached);
|
||||||
|
|
||||||
|
main!(library_benchmark_groups = run_cached_group);
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
use graph_craft::util::*;
|
||||||
|
use graphene_std::Context;
|
||||||
|
use iai_callgrind::{black_box, library_benchmark, library_benchmark_group, main};
|
||||||
|
use interpreted_executor::dynamic_executor::DynamicExecutor;
|
||||||
|
|
||||||
|
fn setup_run_once(name: &str) -> DynamicExecutor {
|
||||||
|
let network = load_from_name(name);
|
||||||
|
let proto_network = compile(network);
|
||||||
|
futures::executor::block_on(DynamicExecutor::new(proto_network)).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[library_benchmark]
|
||||||
|
#[benches::with_setup(args = ["isometric-fountain", "painted-dreams", "procedural-string-lights", "parametric-dunescape", "red-dress", "valley-of-spires"], setup = setup_run_once)]
|
||||||
|
pub fn run_once(executor: DynamicExecutor) {
|
||||||
|
let context: Context = None;
|
||||||
|
black_box(futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), black_box(context))).unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
|
library_benchmark_group!(name = run_once_group; benchmarks = run_once);
|
||||||
|
|
||||||
|
main!(library_benchmark_groups = run_once_group);
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
use graph_craft::proto::ProtoNetwork;
|
||||||
|
use graph_craft::util::*;
|
||||||
|
use iai_callgrind::{black_box, library_benchmark, library_benchmark_group, main};
|
||||||
|
use interpreted_executor::dynamic_executor::DynamicExecutor;
|
||||||
|
|
||||||
|
fn setup_update_executor(name: &str) -> (DynamicExecutor, ProtoNetwork) {
|
||||||
|
let network = load_from_name(name);
|
||||||
|
let proto_network = compile(network);
|
||||||
|
let empty = ProtoNetwork::default();
|
||||||
|
let executor = futures::executor::block_on(DynamicExecutor::new(empty)).unwrap();
|
||||||
|
(executor, proto_network)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[library_benchmark]
|
||||||
|
#[benches::with_setup(args = ["isometric-fountain", "painted-dreams", "procedural-string-lights", "parametric-dunescape", "red-dress", "valley-of-spires"], setup = setup_update_executor)]
|
||||||
|
pub fn update_executor(setup: (DynamicExecutor, ProtoNetwork)) {
|
||||||
|
let (mut executor, network) = setup;
|
||||||
|
let _ = black_box(futures::executor::block_on(executor.update(black_box(network))));
|
||||||
|
}
|
||||||
|
|
||||||
|
library_benchmark_group!(name = update_group; benchmarks = update_executor);
|
||||||
|
|
||||||
|
main!(library_benchmark_groups = update_group);
|
||||||
Loading…
Reference in New Issue