[swift-evolution] [Accepted] SE-0133: Rename flatten() to joined()
Rod Brown
rodney.brown6 at icloud.com
Fri Jul 29 00:21:51 CDT 2016
This makes perfect sense why it would perform worse, and I agree this seems like a legitimate place for a special case.
> On 29 Jul 2016, at 3:01 AM, John McCall via swift-evolution <swift-evolution at swift.org> wrote:
>
>> 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.
>
> John.
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
More information about the swift-evolution
mailing list