From d2827f188b7f0379f169c9f720c356443f3c979c Mon Sep 17 00:00:00 2001 From: nym21 Date: Sat, 26 Jul 2025 14:24:06 +0200 Subject: [PATCH] computer: temp remove rayon --- crates/brk_cli/src/config.rs | 6 +-- .../src/stateful/address_cohorts.rs | 40 +++++++++---------- crates/brk_computer/src/stateful/mod.rs | 6 +-- .../brk_computer/src/stateful/utxo_cohorts.rs | 40 +++++++++---------- 4 files changed, 39 insertions(+), 53 deletions(-) diff --git a/crates/brk_cli/src/config.rs b/crates/brk_cli/src/config.rs index 7569a3557..a89d3ac53 100644 --- a/crates/brk_cli/src/config.rs +++ b/crates/brk_cli/src/config.rs @@ -287,12 +287,8 @@ impl Config { .map_or_else(default_brk_path, |s| Self::fix_user_path(s.as_ref())) } - pub fn outputsdir(&self) -> PathBuf { - self.brkdir().join("outputs") - } - pub fn harsdir(&self) -> PathBuf { - self.outputsdir().join("hars") + self.brkdir().join("hars") } fn path_cookiefile(&self) -> PathBuf { diff --git a/crates/brk_computer/src/stateful/address_cohorts.rs b/crates/brk_computer/src/stateful/address_cohorts.rs index d69a04016..c1cdaad6b 100644 --- a/crates/brk_computer/src/stateful/address_cohorts.rs +++ b/crates/brk_computer/src/stateful/address_cohorts.rs @@ -8,7 +8,6 @@ use brk_exit::Exit; use brk_indexer::Indexer; use brk_vecs::{AnyIterableVec, Computation, File, Format}; use derive_deref::{Deref, DerefMut}; -use rayon::prelude::*; use crate::{ Indexes, fetched, indexes, market, @@ -536,7 +535,7 @@ impl Vecs { }) .collect::>(), ] - .into_par_iter() + .into_iter() .flatten() .try_for_each(|(vecs, stateful)| { vecs.compute_from_stateful(starting_indexes, &stateful, exit) @@ -551,7 +550,7 @@ impl Vecs { starting_indexes: &Indexes, exit: &Exit, ) -> color_eyre::Result<()> { - self.as_mut_vecs().into_par_iter().try_for_each(|(_, v)| { + self.as_mut_vecs().into_iter().try_for_each(|(_, v)| { v.compute_rest_part1(indexer, indexes, fetched, starting_indexes, exit) }) } @@ -570,30 +569,27 @@ impl Vecs { dateindex_to_realized_cap: Option<&impl AnyIterableVec>, exit: &Exit, ) -> color_eyre::Result<()> { - self.0 - .as_boxed_mut_vecs() - .into_iter() - .try_for_each(|mut v| { - v.par_iter_mut().try_for_each(|(_, v)| { - v.compute_rest_part2( - indexer, - indexes, - fetched, - starting_indexes, - market, - height_to_supply, - dateindex_to_supply, - height_to_realized_cap, - dateindex_to_realized_cap, - exit, - ) - }) + self.0.as_boxed_mut_vecs().into_iter().try_for_each(|v| { + v.into_iter().try_for_each(|(_, v)| { + v.compute_rest_part2( + indexer, + indexes, + fetched, + starting_indexes, + market, + height_to_supply, + dateindex_to_supply, + height_to_realized_cap, + dateindex_to_realized_cap, + exit, + ) }) + }) } pub fn safe_flush_stateful_vecs(&mut self, height: Height, exit: &Exit) -> Result<()> { self.as_mut_separate_vecs() - .par_iter_mut() + .into_iter() .try_for_each(|(_, v)| v.safe_flush_stateful_vecs(height, exit)) } } diff --git a/crates/brk_computer/src/stateful/mod.rs b/crates/brk_computer/src/stateful/mod.rs index 86ced4489..d70be1075 100644 --- a/crates/brk_computer/src/stateful/mod.rs +++ b/crates/brk_computer/src/stateful/mod.rs @@ -1232,8 +1232,6 @@ impl Vecs { })?; if height != Height::ZERO && height.unwrap_to_usize() % 10_000 == 0 { - info!("Flushing..."); - let _lock = exit.lock(); addresstypeindex_to_anyaddressindex_reader_opt.take(); @@ -1255,8 +1253,6 @@ impl Vecs { addresstypeindex_to_anyaddressindex_reader_opt.take(); anyaddressindex_to_anyaddressdata_reader_opt.take(); - info!("Flushing..."); - self.flush_states( height, &chain_state, @@ -1597,6 +1593,8 @@ impl Vecs { >, exit: &Exit, ) -> Result<()> { + info!("Flushing..."); + self.utxo_cohorts .as_mut_separate_vecs() .par_iter_mut() diff --git a/crates/brk_computer/src/stateful/utxo_cohorts.rs b/crates/brk_computer/src/stateful/utxo_cohorts.rs index 378d9c29e..54aba00a4 100644 --- a/crates/brk_computer/src/stateful/utxo_cohorts.rs +++ b/crates/brk_computer/src/stateful/utxo_cohorts.rs @@ -9,7 +9,6 @@ use brk_exit::Exit; use brk_indexer::Indexer; use brk_vecs::{AnyIterableVec, Computation, File, Format, StoredIndex}; use derive_deref::{Deref, DerefMut}; -use rayon::prelude::*; use crate::{ Indexes, fetched, indexes, market, @@ -1698,7 +1697,7 @@ impl Vecs { }) .collect::>(), ] - .into_par_iter() + .into_iter() .flatten() .try_for_each(|(vecs, stateful)| { vecs.compute_from_stateful(starting_indexes, &stateful, exit) @@ -1713,7 +1712,7 @@ impl Vecs { starting_indexes: &Indexes, exit: &Exit, ) -> color_eyre::Result<()> { - self.as_mut_vecs().into_par_iter().try_for_each(|(_, v)| { + self.as_mut_vecs().into_iter().try_for_each(|(_, v)| { v.compute_rest_part1(indexer, indexes, fetched, starting_indexes, exit) }) } @@ -1732,30 +1731,27 @@ impl Vecs { dateindex_to_realized_cap: Option<&impl AnyIterableVec>, exit: &Exit, ) -> color_eyre::Result<()> { - self.0 - .as_boxed_mut_vecs() - .into_iter() - .try_for_each(|mut v| { - v.par_iter_mut().try_for_each(|(_, v)| { - v.compute_rest_part2( - indexer, - indexes, - fetched, - starting_indexes, - market, - height_to_supply, - dateindex_to_supply, - height_to_realized_cap, - dateindex_to_realized_cap, - exit, - ) - }) + self.0.as_boxed_mut_vecs().into_iter().try_for_each(|v| { + v.into_iter().try_for_each(|(_, v)| { + v.compute_rest_part2( + indexer, + indexes, + fetched, + starting_indexes, + market, + height_to_supply, + dateindex_to_supply, + height_to_realized_cap, + dateindex_to_realized_cap, + exit, + ) }) + }) } pub fn safe_flush_stateful_vecs(&mut self, height: Height, exit: &Exit) -> Result<()> { self.as_mut_separate_vecs() - .par_iter_mut() + .into_iter() .try_for_each(|(_, v)| v.safe_flush_stateful_vecs(height, exit)) } }