mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-09-10 06:56:18 +00:00
Add manually-runnable benchmarks for runtime profiling (#2005)
* Split benches into two files * Implement executor update bench * Restructure benchmarks * Unify usages of wrap network in scope * Remove unused imports * Fix oom bug * Remove bounding box impl
This commit is contained in:
parent
c5454af48b
commit
f8c7ada572
25 changed files with 378 additions and 270 deletions
21
node-graph/graph-craft/src/util.rs
Normal file
21
node-graph/graph-craft/src/util.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
use crate::document::NodeNetwork;
|
||||
use crate::graphene_compiler::Compiler;
|
||||
use crate::proto::ProtoNetwork;
|
||||
|
||||
pub fn load_network(document_string: &str) -> NodeNetwork {
|
||||
let document: serde_json::Value = serde_json::from_str(document_string).expect("Failed to parse document");
|
||||
serde_json::from_value::<NodeNetwork>(document["network_interface"]["network"].clone()).expect("Failed to parse document")
|
||||
}
|
||||
|
||||
pub fn compile(network: NodeNetwork) -> ProtoNetwork {
|
||||
let compiler = Compiler {};
|
||||
compiler.compile_single(network).unwrap()
|
||||
}
|
||||
|
||||
pub fn load_from_name(name: &str) -> NodeNetwork {
|
||||
let content = std::fs::read(format!("../../demo-artwork/{name}.graphite")).expect("failed to read file");
|
||||
let content = std::str::from_utf8(&content).unwrap();
|
||||
load_network(content)
|
||||
}
|
||||
|
||||
pub static DEMO_ART: [&str; 5] = ["painted-dreams", "red-dress", "valley-of-spires", "isometric-fountain", "procedural-string-lights"];
|
Loading…
Add table
Add a link
Reference in a new issue