Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node-graph/interpreted-executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ serde = { workspace = true }
graph-craft = { workspace = true, features = ["loading"] }
criterion = { workspace = true }
iai-callgrind = { workspace = true }
preprocessor = { workspace = true }

# Benchmarks
[[bench]]
Expand Down
6 changes: 5 additions & 1 deletion node-graph/interpreted-executor/benches/benchmark_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ use interpreted_executor::dynamic_executor::DynamicExecutor;
use interpreted_executor::util::wrap_network_in_scope;

pub fn setup_network(name: &str) -> (DynamicExecutor, ProtoNetwork) {
let network = load_from_name(name);
let mut network = load_from_name(name);
let editor_api = std::sync::Arc::new(EditorApi::default());
println!("generating substitutions");
let substitutions = preprocessor::generate_node_substitutions();
println!("expanding network");
preprocessor::expand_network(&mut network, &substitutions);
let network = wrap_network_in_scope(network, editor_api);
let proto_network = compile(network);
let executor = block_on(DynamicExecutor::new(proto_network.clone())).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion node-graph/interpreted-executor/benches/run_cached.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn subsequent_evaluations(c: &mut Criterion) {
bench_for_each_demo(&mut group, |name, g| {
let (executor, _) = setup_network(name);
g.bench_function(name, |b| {
b.iter(|| futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), criterion::black_box(context))).unwrap())
b.iter(|| futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), std::hint::black_box(context))).unwrap())
});
});
group.finish();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use criterion::measurement::Measurement;
use criterion::{BenchmarkGroup, Criterion, black_box, criterion_group, criterion_main};
use criterion::{BenchmarkGroup, Criterion, criterion_group, criterion_main};
use graph_craft::graphene_compiler::Executor;
use graph_craft::proto::ProtoNetwork;
use graph_craft::util::{DEMO_ART, compile, load_from_name};
Expand All @@ -16,7 +16,7 @@ fn update_executor<M: Measurement>(name: &str, c: &mut BenchmarkGroup<M>) {
c.bench_function(name, |b| {
b.iter_batched(
|| (executor.clone(), proto_network.clone()),
|(mut executor, network)| futures::executor::block_on(executor.update(black_box(network))),
|(mut executor, network)| futures::executor::block_on(executor.update(std::hint::black_box(network))),
criterion::BatchSize::SmallInput,
)
});
Expand Down
2 changes: 1 addition & 1 deletion node-graph/interpreted-executor/benches/run_once.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn run_once(c: &mut Criterion) {
g.bench_function(name, |b| {
b.iter_batched(
|| setup_network(name),
|(executor, _)| futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), criterion::black_box(context))).unwrap(),
|(executor, _)| futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), std::hint::black_box(context))).unwrap(),
criterion::BatchSize::SmallInput,
)
});
Expand Down
2 changes: 1 addition & 1 deletion node-graph/interpreted-executor/benches/update_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn update_executor(c: &mut Criterion) {
let executor = futures::executor::block_on(DynamicExecutor::new(empty)).unwrap();
(executor, proto_network)
},
|(mut executor, network)| futures::executor::block_on(executor.update(criterion::black_box(network))),
|(mut executor, network)| futures::executor::block_on(executor.update(std::hint::black_box(network))),
criterion::BatchSize::SmallInput,
)
});
Expand Down
4 changes: 2 additions & 2 deletions node-graph/preprocessor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ pub fn expand_network(network: &mut NodeNetwork, substitutions: &HashMap<ProtoNo

pub fn generate_node_substitutions() -> HashMap<ProtoNodeIdentifier, DocumentNode> {
let mut custom = HashMap::new();
// We pre initialize the node registry here to avoid a deadlock
let into_node_registry = &*interpreted_executor::node_registry::NODE_REGISTRY;
let node_registry = graphene_core::registry::NODE_REGISTRY.lock().unwrap();
for (id, metadata) in graphene_core::registry::NODE_METADATA.lock().unwrap().iter() {
let id = id.clone();
Expand All @@ -54,8 +56,6 @@ pub fn generate_node_substitutions() -> HashMap<ProtoNodeIdentifier, DocumentNod

let identity_node = ops::identity::IDENTIFIER;

let into_node_registry = &interpreted_executor::node_registry::NODE_REGISTRY;

let mut generated_nodes = 0;
let mut nodes: HashMap<_, _, _> = node_io_types
.iter()
Expand Down
Loading