Browse Source

improve performance and disable parallelism by default

Evan Almloff 2 năm trước cách đây
mục cha
commit
40292e40b2

+ 2 - 1
packages/native-core-macro/src/lib.rs

@@ -241,12 +241,13 @@ let get_child_view = {
                 use dioxus_native_core::exports::shipyard::{IntoWorkloadSystem, Get, AddComponent};
                 use dioxus_native_core::tree::TreeRef;
                 use dioxus_native_core::prelude::{NodeType, NodeView};
+                
+                let node_mask = Self::NODE_MASK.build();
 
                 (move |data: #combined_dependencies_quote, run_view: dioxus_native_core::RunPassView #trait_generics| {
                     let (#(#split_views,)*) = data;
                     let (tree, types, _, _, _) = &run_view;
                     let tree = tree.clone();
-                    let node_mask = Self::NODE_MASK.build();
                     let node_types = types.clone();
                     dioxus_native_core::run_pass(type_id, dependants.clone(), pass_direction, run_view, |id, context| {
                         let node_data: &NodeType<_> = node_types.get(id).unwrap_or_else(|err| panic!("Failed to get node type {:?}", err));

+ 2 - 2
packages/native-core/Cargo.toml

@@ -28,10 +28,9 @@ hashbrown = { version = "0.13.2", features = ["raw"] }
 lightningcss = "1.0.0-alpha.39"
 
 rayon = "1.6.1"
-shipyard = "0.6.2"
+shipyard = { version = "0.6.2", features = ["proc", "std"], default-features = false }
 shipyard_hierarchy = "0.6.0"
 
-
 [dev-dependencies]
 rand = "0.8.5"
 dioxus = { path = "../dioxus", version = "^0.3.0" }
@@ -42,3 +41,4 @@ dioxus-native-core-macro = { path = "../native-core-macro" }
 [features]
 default = []
 dioxus = ["dioxus-core"]
+parallel = ["shipyard/parallel"]

+ 1 - 1
packages/tui/Cargo.toml

@@ -30,7 +30,7 @@ smallvec = "1.6"
 rustc-hash = "1.1.0"
 anymap = "1.0.0-beta.2"
 futures-channel = "0.3.25"
-shipyard = "0.6.2"
+shipyard = { version = "0.6.2", features = ["proc", "std"], default-features = false }
 
 [dev-dependencies]
 dioxus = { path = "../dioxus" }