Skip to content

Conversation

@nevans
Copy link
Collaborator

@nevans nevans commented Nov 22, 2025

You can build an ordered set from an enumarable input as simply as enum.inject(Net::IMAP::SequenceSet.new, &:append). But, prior to this change, that could easily give you very inefficient output, e.g: it might return 9,1,2,3,4,5,6,7,8. With this change, the same input will return 9,1:8.

This also short-circuits whenever @string is nil, avoiding string generation. This significantly improves performance when the set remains monotonically sorted.

You can build an ordered set from an enumarable input as simply as
`enum.inject(Net::IMAP::SequenceSet.new, &:append)`.  But, prior to this
change, that could easily give you very inefficient output, e.g: it
might return `9,1,2,3,4,5,6,7,8`.  With this change, the same input will
return `9,1:8`.

This also short-circuits whenever `@string` is `nil`, avoiding string
generation.  This significantly improves performance when the set
remains monotonically sorted.
@nevans nevans merged commit 6de22fd into master Nov 22, 2025
32 checks passed
@nevans nevans deleted the sequence_set/coalesced-append branch November 22, 2025 19:20
@nevans nevans added the enhancement New feature or request label Nov 25, 2025
@nevans nevans added the sequence-set Any code the IMAP `sequence-set` data type or grammar rule, especially the SequenceSet class. label Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request sequence-set Any code the IMAP `sequence-set` data type or grammar rule, especially the SequenceSet class.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants