-
Notifications
You must be signed in to change notification settings - Fork 87
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
Implements PriorityTaskQueue with std's LinkedList rather than a custom linked list implementation #706
Conversation
…om linked list implementation.
We tested with the existing micro benchmarks from the rusty-hermit project's benchmark directory. With these changes, the scheduling time for 2 threads was an average of 2880 ticks. Another potential issue with this implementation is that LinkedList's remove method is unstable, so we used a work around to avoid that. |
Looks good! But I will discuss it with @mkroening Just a double check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! Thanks a lot!
Two minor remarks, though the current code is definitely an improvement already. 👍
…d correctly set priority bitmask to reflect empty lists.
Thank you for the feedback :). We've addressed those 2 changes and made sure the priority bitmap is properly set when removing a task from a list. Thank you @ynchen2829 for authoring these changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Thanks a lot! :)
bors r+
@@ -272,6 +272,30 @@ impl PriorityTaskQueue { | |||
task | |||
} | |||
|
|||
/// Remove the task at index from the queue and return that task, | |||
/// or None if the index is out of range or the list is empty. | |||
fn remove_from_queue( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, nice! You even made this a fully fledged method. 👍
Build succeeded:
|
Fixes #377.