mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-18 18:38:05 +08:00
Replace hashing algorithm and disable debug logging for improved performance
This commit is contained in:
committed by
Keavon Chambers
parent
7ce9d6db05
commit
1c50f0030c
@@ -379,14 +379,7 @@ impl NodeNetwork {
|
||||
}
|
||||
NodeInput::Value { tagged_value, exposed } => {
|
||||
// Skip formatting very large values for seconds in performance speedup
|
||||
let name = if matches!(
|
||||
tagged_value,
|
||||
TaggedValue::Image(_) | TaggedValue::RcImage(_) | TaggedValue::Color(_) | TaggedValue::Subpath(_) | TaggedValue::RcSubpath(_)
|
||||
) {
|
||||
"Value".to_string()
|
||||
} else {
|
||||
format!("Value: {:?}", tagged_value)
|
||||
};
|
||||
let name = "Value".to_string();
|
||||
let new_id = map_ids(id, gen_id());
|
||||
let value_node = DocumentNode {
|
||||
name,
|
||||
@@ -654,8 +647,6 @@ mod test {
|
||||
network.flatten_with_fns(1, |self_id, inner_id| self_id * 10 + inner_id, gen_node_id);
|
||||
let flat_network = flat_network();
|
||||
|
||||
println!("{:#?}", network);
|
||||
println!("{:#?}", flat_network);
|
||||
assert_eq!(flat_network, network);
|
||||
}
|
||||
|
||||
@@ -746,7 +737,7 @@ mod test {
|
||||
(
|
||||
14,
|
||||
DocumentNode {
|
||||
name: "Value: U32(2)".into(),
|
||||
name: "Value".into(),
|
||||
inputs: vec![NodeInput::Value {
|
||||
tagged_value: value::TaggedValue::U32(2),
|
||||
exposed: false,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::borrow::Cow;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::hash::Hash;
|
||||
use xxhash_rust::xxh3::Xxh3;
|
||||
|
||||
use crate::document::value;
|
||||
use crate::document::NodeId;
|
||||
@@ -135,7 +136,8 @@ impl ProtoNodeInput {
|
||||
impl ProtoNode {
|
||||
pub fn stable_node_id(&self) -> Option<NodeId> {
|
||||
use std::hash::Hasher;
|
||||
let mut hasher = std::collections::hash_map::DefaultHasher::new();
|
||||
let mut hasher = Xxh3::new();
|
||||
|
||||
self.identifier.name.hash(&mut hasher);
|
||||
self.construction_args.hash(&mut hasher);
|
||||
match self.input {
|
||||
@@ -593,12 +595,12 @@ mod test {
|
||||
assert_eq!(
|
||||
ids,
|
||||
vec![
|
||||
15907139529964845467,
|
||||
1552706903207877482,
|
||||
15211082859148708110,
|
||||
3361684226823984981,
|
||||
16609475913638361514,
|
||||
5640155373642511298
|
||||
7332206428857154453,
|
||||
946497269036214321,
|
||||
3038115864048241698,
|
||||
1932610308557160863,
|
||||
2105748431407297710,
|
||||
8596220090685862327
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user