A lot of basic functionality requires the Foundation overlay, such as
String.components(separatedBy:). Besides the unfortunate need to bridge the string into Obj-C, any strings created by this are also going to be backed by
NSString. This was bad enough before, but now in Swift 5 that native strings are UTF-8 we can expect performance-sensitive code to be optimized more for UTF-8 and thus having UTF-16 strings will be a bigger performance hit.
I'd like to see us consider rewriting some of these Foundation overlay methods in Swift. They can still be part of the overlay, but instead of bridging into the Foundation framework directly, they could just be implemented in pure Swift.
components(separatedBy:) would be a great candidate for this.
We can't reimplement everything, obviously. In particular, things that rely on locales would be complicated to rewrite, or things like the enumerate substrings API, or regular expression searching. But the simpler stuff like
components(separatedBy:) we absolutely could write ourselves.
I've actually filed this as a bug, since it's purely an implementation detail, I'm just posting this here to get some visibility: SR-10225