Replace easy-parallel with scoped-pool for path searches

The easy-parallel crate spawned new threads on each call, which was resulting in way too many threads.

Co-Authored-By: Brooks Swinnerton <934497+bswinnerton@users.noreply.github.com>
This commit is contained in:
Nathan Sobo
2021-04-14 09:08:52 -06:00
co-authored by Brooks Swinnerton
parent f455355c78
commit 4cef25eff8
7 changed files with 54 additions and 13 deletions
+6
View File
@@ -414,6 +414,7 @@ impl MutableAppContext {
windows: HashMap::new(),
ref_counts: Arc::new(Mutex::new(RefCounts::default())),
background: Arc::new(executor::Background::new()),
scoped_pool: scoped_pool::Pool::new(num_cpus::get()),
},
actions: HashMap::new(),
global_actions: HashMap::new(),
@@ -1336,6 +1337,7 @@ pub struct AppContext {
windows: HashMap<usize, Window>,
background: Arc<executor::Background>,
ref_counts: Arc<Mutex<RefCounts>>,
scoped_pool: scoped_pool::Pool,
}
impl AppContext {
@@ -1374,6 +1376,10 @@ impl AppContext {
pub fn background_executor(&self) -> &Arc<executor::Background> {
&self.background
}
pub fn scoped_pool(&self) -> &scoped_pool::Pool {
&self.scoped_pool
}
}
impl ReadModel for AppContext {
+1
View File
@@ -29,3 +29,4 @@ pub use presenter::{
AfterLayoutContext, Axis, DebugContext, EventContext, LayoutContext, PaintContext,
SizeConstraint, Vector2FExt,
};
pub use scoped_pool;