[swift-evolution] [Accepted] SE-0133: Rename flatten() to joined()

John McCall rjmccall at apple.com
Thu Jul 28 12:01:20 CDT 2016

> On Jul 28, 2016, at 6:38 AM, Paulo Faria via swift-evolution <swift-evolution at swift.org> wrote:
>>> I doubt there would be a performance difference between adding `func joined() { return joined(separator: "") }` and changing the parameter to `separator: String = "”`.
>> I’ll let a stdlib guru comment on this :-)
> I’m very curious about this. Default parameters are really slower?

The version that takes an arbitrary separator as a parameter (defaulted or not) does twice as many appends unless it specifically recognizes the empty separator as a special case.

That said, I'm not sure it shouldn't try to recognize the empty separator as a special case.


More information about the swift-evolution mailing list