Skip to content

Conversation

@nevans
Copy link
Collaborator

@nevansnevans commented Aug 25, 2025

This was originally part of some performance improvements. But any speedup reported by the (newly added) benchmark isn't significant. So this change is more for the semantics of these methods.

Changes:

  • Add benchmarks for #dup, #clone, and #new with a SequenceSet input
  • don't delegate #initialize_clone and #replace to #initialize_dup
  • call #modifying! in #replace, but not in #initialize_dup or #initialize_clone
  • copy the string in #replace, but not in #initialize_dup or #initialize_clone. @string is always frozen, so the default shallow copy is enough.

This was originally part of some performance improvements. But any speedup reported by the (newly added) benchmark isn't significant. So this change is more for the semantics of these methods. Changes: * don't delegate `#initialize_clone` and `#replace` to `#initialize_dup` * call `#modifying!` and copy the string in `#replace` * don't call `#modifying!` in `#initialize_dup` or `#initialize_clone` * don't copy or build the string in `#initialize_dup`. `@string` is always frozen, so the default shallow copy is enough.
@nevansnevans merged commit 09d2bc0 into masterAug 27, 2025
49 of 69 checks passed
@nevansnevans deleted the sequence_set/refactor-copy-methods branch August 27, 2025 16:27
@nevansnevans 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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sequence-setAny 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

@nevans