Appending to an Array stored in an enum case payload: O(1) or O(n)?

This should optimize fine. Using as an example, you can see that while there is an ARC operation, that retain is on the String argument, not on the array of entries. As this doesn't +1 the array of entries, it doesn't inherently cause a CoW.

In older versions of Swift the compiler was not so smart, and so we (SwiftNIO) did use exactly this pattern by having a deliberately uninhabited case called _modifying or similar. This is largely unnecessary now.