From dfcf69542a85e7707fc3dc1e6e7e121b9ae75fbb Mon Sep 17 00:00:00 2001 From: andres Date: Tue, 18 Jun 2024 16:17:33 -0500 Subject: [PATCH] chore: Optimizes least_common_parents --- src/directed/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/directed/mod.rs b/src/directed/mod.rs index 11a7457..aa848f2 100644 --- a/src/directed/mod.rs +++ b/src/directed/mod.rs @@ -475,16 +475,18 @@ impl DirectedGraph { ) -> GraphInteractionResult> { // Declare used buffers let selected_buf = unsafe { self.u32x1_vec_0() }; + let selected_buf_set = unsafe { self.u32x1_set_0() }; let parents = unsafe { self.u32x1_vec_1() }; let least_common_parents = unsafe { self.u32x1_vec_2() }; self.get_internal_mul(selected, selected_buf)?; + selected_buf_set.extend(selected_buf.iter().copied()); selected_buf.iter().for_each(|&child| { self.parents_u32(&[child], parents); let parent_not_in_selection = parents .drain(..) - .any(|parent| selected_buf.contains(&parent)) + .any(|parent| selected_buf_set.contains(&parent)) .not(); if parent_not_in_selection { least_common_parents.push(child);