Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Trim TASO priority queue progresively #179

Merged
merged 2 commits into from
Oct 9, 2023
Merged

Conversation

aborgna-q
Copy link
Collaborator

Instead of cutting the truncating in half, we just pop the last element before inserting if we're at capacity.

Sets the new default size to 100, as that is more sensible for our workloads.

@aborgna-q aborgna-q requested a review from lmondada October 9, 2023 15:37
Copy link
Contributor

@lmondada lmondada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I was also thinking that this halving of the queue size seemed a bit useless.

Sorry, now my comments ended up on the wrong PR!

@@ -46,6 +48,8 @@ impl<P: Ord, C> HugrPQ<P, C> {
}

/// Push a Hugr into the queue.
///
/// If the queue is full, the most last will be dropped.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most last -> element with highest cost is clearer. Also below.

}
if self.len() >= self.max_size {
let max_cost = self.max_cost().unwrap();
if self.len() >= self.max_size && cost >= *max_cost {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably remove the first inner condition?

@aborgna-q aborgna-q added this pull request to the merge queue Oct 9, 2023
Merged via the queue into main with commit 6d2784d Oct 9, 2023
@aborgna-q aborgna-q deleted the feat/taso-queue-trim branch October 9, 2023 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants