Swift tanking performance by excessively copying enums when pattern matching?

Not directly related to this specific situation… but I do believe it is a known performance tradeoff with passing and copying large value types. This is why engineers might choose reference semantics (making FruitComparator a class) or a copy-on-write data-structure (making FruitComparator wrap a class reference).

1 Like