Skip to content

Commit

Permalink
Move done check to where it was before
Browse files Browse the repository at this point in the history
This resolves a MASSIVE performance regression
  • Loading branch information
Erin van der Veen committed Feb 14, 2024
1 parent 24e4aa6 commit 798a339
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@ fn process(
// Sender channel to communicate DerivationDescription to the main thread
tx: mpsc::Sender<DerivationDescription>,
) -> Result<()> {
// check if the build_input has already be processed
let done = {
let mut collected_paths = collected_paths.lock().unwrap();
!collected_paths.insert(attribute_path.to_string())
};

if done {
log::debug!("Skipping already processed derivation: {}", attribute_path);
return Ok(());
}

log::debug!("Processing derivation: {:?}", attribute_path);

// call describe_derivation to get the derivation description
Expand All @@ -44,6 +33,23 @@ fn process(
.build_inputs
.into_par_iter()
.map(|build_input| -> Result<()> {
// check if the build_input has already be processed
let done = {
let mut collected_paths = collected_paths.lock().unwrap();
match build_input.output_path {
Some(store_path) => !collected_paths.insert(store_path.to_string()),
None => false,
}
};

if done {
log::debug!(
"Skipping already processed derivation: {}",
build_input.attribute_path.to_string()
);
return Ok(());
}

process(
collected_paths,
flake_ref,
Expand Down

0 comments on commit 798a339

Please sign in to comment.