Skip to content

Conversation

@schneems
Copy link
Collaborator

The frontier currently holds logic for "track lines we've not yet created blocks out of" as well as "evict blocks that are engulfed by larger blocks". These are two logically separate concerns that can be extracted into their own classes.

  • Unvisited class, holds a hash of lines that have been visited and makes sure visited lines don't show up when pop is called
  • Engulf class, a priority queue that also performs an engulf search and mark. When a block is marked as being deleted from the queue it will not show up in pop.

In addition there's a minor perf in the unvisited logic. We don't have to search and remove the element in the array, we can be lazy and remove it once it finds its way to the end of the queue since we're already tracking them in a hash. Also moved to make the hash compare_by_identity. Results are too close to post perf difference without doing some statistical analysis.

The logic that tracks if the frontier has created a block based on a given line or not is tightly coupled to the Frontier class. By moving it out we enable re-use and possible ergonomic or performance optimizations as well as allowing separation of concerns for testing.
The queuing and engulfing logic are tied together. We can bundle the two of them into a single class with a specific interface.
@schneems schneems merged commit 4255d30 into main Jan 14, 2022
@schneems schneems deleted the schneems/queue-logic-engulf-logic branch January 14, 2022 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants