Merged
Conversation
b9947e0 to
2ee1aae
Compare
libo
reviewed
Jan 12, 2026
libo
reviewed
Jan 12, 2026
libo
reviewed
Jan 12, 2026
0010817 to
065793a
Compare
bquorning
reviewed
Jan 12, 2026
065793a to
343bed7
Compare
bquorning
previously approved these changes
Jan 16, 2026
Member
bquorning
left a comment
There was a problem hiding this comment.
Given that SortedSet was introduced in order to fix “issues in the cache layer”, I think it makes sense to sort when we compute the (memoized) cache key instead of every time #dependencies is called.
However, we don’t know if any of our users are using #dependencies to calculate their own cache key – so maybe this is a breaking change?
|
Yeah the breaking change issue was why I suggested to make the existing methods behave as before. Are we afraid of the cost of calling sort on every read? It's a |
|
BTW original PR ...summer of 2014 #78 |
bquorning
reviewed
Jan 16, 2026
d82cc1f to
2a52432
Compare
sorted_set stopped working in Ruby after internal Set changes (changes description: https://bugs.ruby-lang.org/issues/21216, https://rubyreferences.github.io/rubychanges/4.0.html#set). Set subclasses cannot use `@hash` anymore, which breaks the way `sorted_set` works (it replaces `@hash` with a red-black tree from `rbtree`). We need to preserve an ordered list of dependencies to build the same cache key every time (introduced in this commit: e132533). Since these lists are pretty short, and updates of these lists don’t happen on a hot path, an array that preserves the order is good enough. We will maintain uniqueness and sort order in both methods that update this array.
2a52432 to
b053046
Compare
bquorning
approved these changes
Mar 5, 2026
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.
sorted_set stopped working in Ruby after internal Set changes (changes description: https://bugs.ruby-lang.org/issues/21216, https://rubyreferences.github.io/rubychanges/4.0.html#set).
Set subclasses cannot use
@hashanymore, which breaks the waysorted_setworks (it replaces@hashwith a red-black tree fromrbtree).We only need to preserve an ordered list of dependencies to build the same cache key every time (introduced in this commit: e132533). So, we can sort them before building a cache key and use a regular Set.
Alternatively, we could rebuild a new Set every time a dependency is added: