I don't see this, not in your test at least... the async/await version takes 23 seconds regardless of whether I'm using ~String.contains
or String.contains2
:
Wrong code hidden, see below
// in a file without `import Foundation`
extension String {
func contains2(_ v: String) -> Bool {
contains(v)
}
func contains2(_ v: Regex<Substring>) -> Bool {
contains(v)
}
}
It is possible even for macOS/iOS apps – by bringing small key fragments to swift files that don't have import Foundation
– but not many people would bother doing that.
Oops. That's factually wrong. I assumed that a separate file with no import Foundation
in it would choose non-foundation implementation for, say, String.contains
. That's not the case if import Foundation
being used in other files of the same project.
Correct answer then – no, it's not realistic for iOS apps and non server macOS apps to not use Foundation, the situation for server apps is different.