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 > <[email protected]> wrote: > >> On Jul 28, 2016, at 6:38 AM, Paulo Faria via swift-evolution >> <[email protected]> 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 > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution _______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
