Decrease graph compilation time significantly (#1368)

* Decrease compilation time significantly

* Refactor reorder_ids method to improve performance
This commit is contained in:
Dennis Kobert
2023-08-06 21:36:44 +02:00
committed by GitHub
parent c653fe9579
commit 3262f637d1
13 changed files with 125 additions and 112 deletions

View File

@@ -50,7 +50,7 @@ log = "0.4"
bezier-rs = { path = "../../libraries/bezier-rs", features = ["serde"] }
glam = { version = "0.24", features = ["serde"] }
node-macro = { path = "../node-macro" }
xxhash-rust = { workspace = true }
rustc-hash = { workspace = true }
serde_json = "1.0.96"
reqwest = { version = "0.11.18", features = ["rustls", "rustls-tls", "json"] }
futures = "0.3.28"

View File

@@ -26,7 +26,7 @@ pub struct GpuCompiler<TypingContext, ShaderIO> {
async fn compile_gpu(node: &'input DocumentNode, mut typing_context: TypingContext, io: ShaderIO) -> compilation_client::Shader {
let compiler = graph_craft::graphene_compiler::Compiler {};
let DocumentNodeImplementation::Network(ref network) = node.implementation else { panic!() };
let proto_networks: Vec<_> = compiler.compile(network.clone(), true).collect();
let proto_networks: Vec<_> = compiler.compile(network.clone()).collect();
for network in proto_networks.iter() {
typing_context.update(network).expect("Failed to type check network");
@@ -229,7 +229,7 @@ async fn create_compute_pass_descriptor<T: Clone + Pixel + StaticTypeSized>(
..Default::default()
};
log::debug!("compiling network");
let proto_networks = compiler.compile(network.clone(), true).collect();
let proto_networks = compiler.compile(network.clone()).collect();
log::debug!("compiling shader");
let shader = compilation_client::compile(
proto_networks,
@@ -442,7 +442,7 @@ async fn blend_gpu_image(foreground: ImageFrame<Color>, background: ImageFrame<C
..Default::default()
};
log::debug!("compiling network");
let proto_networks = compiler.compile(network.clone(), true).collect();
let proto_networks = compiler.compile(network.clone()).collect();
log::debug!("compiling shader");
let shader = compilation_client::compile(

View File

@@ -454,8 +454,7 @@ macro_rules! generate_imaginate_node {
$(let $val = self.$val.eval(());)*
use std::hash::Hasher;
use xxhash_rust::xxh3::Xxh3;
let mut hasher = Xxh3::new();
let mut hasher = rustc_hash::FxHasher::default();
frame.image.hash(&mut hasher);
let hash =hasher.finish();