Use skip-list multi-map to speed up job queue #1212
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Changes the data structure for job queue from a priority queue to a skip-list-based multimap. During some profiling for the Clipper model, we found that removing condition jobs from the queue in order to reprioritize them was taking significant time. To mitigate this, we use a skip-list based map to order batches, and store a set for each batch. In practice, this reduced runtime for a 1-year plan with the Clipper model from ~60 seconds to ~20 seconds.
Verification
Both the clipper model and a toy model were run with this changes while recording the number of jobs run and the number of resource samples taken. These numbers were verified not to change because of this change.
Documentation
N/A - purely an internal refactor
Future work
N/A - standalone change