Conversation
At some point in the development of diff elision, it looks like dirty panes might have been padded to preserve context. However, the implementation that was eventually introduced in d18bd14 ended up essentially cloning the original pane with no padding. This makes #padded, and subsequently #capped_to, unnecessary.
By construction, `dirty_panes` never returns contiguous dirty panes. Since the panes were never really padded, those panes remained untouched until passed into `#combine_congruent_panes`, so that method was essentially a no-op. Removing that method subsequently obviated the need for `#padded_dirty_panes` entirely.
`sorted_boxes` was first sorted, then used in an `#any?` check. In worst-case time complexity, this is just as (in)efficient as checking against the unsorted boxes. We can do better by sorting boxes by beginning ascending and ending descending. Algorithm explanation in comments.
jas14
added a commit
to gschlager/super_diff
that referenced
this pull request
Feb 14, 2026
While reviewing splitwise#300, I noticed some unrelated clean-up opportunities in `TieredLinesElider`. Most importantly, `Pane#padded` was essentially a no-op. This PR gets rid of it, and simplifies up the call stack through `TieredLinesElider#panes`. Less importantly, and more for my own satisfaction, `#filter_out_boxes_fully_contained_in_others` was $O(n^2)$; assuming sorting is sub-quadratic, it's also now sub-quadratic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
While reviewing #300, I noticed some unrelated clean-up opportunities in
TieredLinesElider.Most importantly,
Pane#paddedwas essentially a no-op. This PR gets rid of it, and simplifies up the call stack throughTieredLinesElider#panes.Less importantly, and more for my own satisfaction,$O(n^2)$ ; assuming sorting is sub-quadratic, it's also now sub-quadratic.
#filter_out_boxes_fully_contained_in_otherswas