Commit 09d2bc0
committed
♻️ Refactor SequenceSet#dup, #clone, and #replace
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.1 parent c79f860 commit 09d2bc0
File tree
2 files changed
+105
-5
lines changed- benchmarks
- lib/net/imap
2 files changed
+105
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
550 | | - | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
551 | 554 | | |
552 | 555 | | |
553 | 556 | | |
| |||
1734 | 1737 | | |
1735 | 1738 | | |
1736 | 1739 | | |
| 1740 | + | |
| 1741 | + | |
1737 | 1742 | | |
1738 | 1743 | | |
1739 | 1744 | | |
1740 | 1745 | | |
1741 | 1746 | | |
1742 | 1747 | | |
1743 | 1748 | | |
1744 | | - | |
| 1749 | + | |
| 1750 | + | |
1745 | 1751 | | |
1746 | 1752 | | |
1747 | 1753 | | |
1748 | | - | |
1749 | | - | |
1750 | | - | |
| 1754 | + | |
1751 | 1755 | | |
1752 | 1756 | | |
1753 | 1757 | | |
| |||
0 commit comments